Installing dependencies fail with pnpm

I run a static website with the name of dozzle-dev. The logs can be found at Netlify App.

Every so often, installing the deps step fails.

The error looks like:

3:09:34 PM:  ENOENT  ENOENT: no such file or directory, open "/opt/build/.pnpm-store/v3/files/fa/4e2975982cd6a88cf8e5244a3c7de9888ab17b266f9f5ebc5a2abfc48a3b4ebba8103e676b3f742cc98a3fd985d41cb36ce54c081129f7a288b9bc3d0daabf-index.json"
3:09:34 PM: Error during pnpm install
3:09:34 PM: Build was terminated: dependency_installation script returned non-zero exit code: 1
3:09:34 PM: Failing build: Failed to install dependencies

I have searched through the forums and haven’t found what is causing this. The only way I can fix this, is to clear the cache and rebuild. This works, but very inconvenient because it could be weeks before I realize it has been failing.

The error looks to be caching with pnpm store. Is there a fix?

Hi @amir20, thanks for the post and welcome.

The error is happening on the quoted line above.

I see you are using pnpm, therefore in order to fix the problem kindly follow the stpes below.

rm pnpm-lock.yaml
rm -rf node_modules
rm -rf ~/Library/pnpm
pnpm install

If you are using a macOS (Silicon M1, M2) run the commands below

pnpm store prune
rm -rf ~/Library/pnpm/store/v3/files/
pnpm install

Once you are done kindly redeploy to see if it works.

Let me know the outcome.

Thanks.

At this point, I’ll try anything.

I have done everything. Although, it doesn’t make sense because the error I am seeing on Netlify and not personal computer. I do have Silicon Mac.

I did git commit again and pushed master to Netlify. Still getting same error. Here is the full log if it helps:

9:41:35 AM: build-image version: 6c108058a8eab898e5e003ecad67a8f5f2f8c0bc (focal)
9:41:35 AM: buildbot version: 1e933903082ddddf955fd2397e5d98197c8a8b2b
9:41:35 AM: Fetching cached dependencies
9:41:35 AM: Starting to download cache of 191.6MB
9:41:38 AM: Finished downloading cache in 2.825s
9:41:38 AM: Starting to extract cache
9:41:39 AM: Finished extracting cache in 1.482s
9:41:39 AM: Finished fetching cache in 4.363s
9:41:39 AM: Starting to prepare the repo for build
9:41:40 AM: Preparing Git Reference refs/heads/master
9:41:41 AM: Custom publish path detected. Proceeding with the specified path: "docs/.vitepress/dist"
9:41:41 AM: Custom functions path detected. Proceeding with the specified path: "docs/functions"
9:41:41 AM: Custom build command detected. Proceeding with the specified command: "pnpm docs:build"
9:41:41 AM: Starting to install dependencies
9:41:41 AM: Python version set to 3.8
9:41:41 AM: Attempting Ruby version 2.7.2, read from environment
9:41:42 AM: Using Ruby version 2.7.2
9:41:43 AM: Started restoring cached go cache
9:41:43 AM: Finished restoring cached go cache
9:41:43 AM: go version go1.19.13 linux/amd64
9:41:43 AM: Using PHP version 8.0
9:41:44 AM: Started restoring cached Node.js version
9:41:44 AM: Finished restoring cached Node.js version
9:41:45 AM: v18.18.2 is already installed.
9:41:45 AM: Now using node v18.18.2 (npm v9.8.1)
9:41:45 AM: Enabling Node.js Corepack
9:41:45 AM: Started restoring cached build plugins
9:41:45 AM: Finished restoring cached build plugins
9:41:45 AM: Started restoring cached corepack dependencies
9:41:45 AM: Finished restoring cached corepack dependencies
9:41:45 AM: pnpm workspaces detected
9:41:45 AM: Started restoring workspace docs node modules
9:41:45 AM: Finished restoring workspace docs node modules
9:41:45 AM: Started restoring workspace root node modules
9:41:45 AM: Finished restoring workspace root node modules
9:41:46 AM: Installing npm packages using pnpm version 8.9.2
9:41:47 AM: Scope: all 2 workspace projects
9:41:47 AM: Lockfile is up to date, resolution step is skipped
9:41:47 AM: docs                                     | Progress: resolved 1, reused 0, downloaded 0, added 0
9:41:47 AM: docs                                     |  +44  -40 ++++----
9:41:48 AM: Progress: resolved 1, reused 0, downloaded 0, added 0
9:41:48 AM: docs                                     | Progress: resolved 44, reused 0, downloaded 0, added 0
9:41:48 AM: Packages: +170 -160
9:41:48 AM: +++++++++++++++++++++++++++++++++++++++++---------------------------------------
9:41:49 AM: Progress: resolved 170, reused 0, downloaded 19, added 25
9:41:49 AM: docs                                     | Progress: resolved 44, reused 0, downloaded 43, added 43
9:41:50 AM: Progress: resolved 170, reused 0, downloaded 117, added 123
9:41:50 AM: docs                                     | Progress: resolved 44, reused 0, downloaded 44, added 43
9:41:50 AM: docs                                     | Progress: resolved 44, reused 0, downloaded 44, added 44, done
9:41:51 AM: Progress: resolved 170, reused 0, downloaded 162, added 168
9:41:52 AM: Progress: resolved 170, reused 0, downloaded 163, added 169
9:41:52 AM: Progress: resolved 170, reused 0, downloaded 163, added 170, done
9:41:53 AM: Failed during stage "Install dependencies": dependency_installation script returned non-zero exit code: 1
9:41:53 AM: dependencies:
9:41:53 AM: - @iconify-json/mdi 1.1.54
9:41:53 AM: - @intlify/unplugin-vue-i18n 1.4.0
9:41:53 AM: - @vueuse/components 10.5.0
9:41:53 AM: - @vueuse/core 10.5.0
9:41:53 AM: - @vueuse/integrations 10.5.0
9:41:53 AM: - @vueuse/math 10.5.0
9:41:53 AM: - @vueuse/router 10.5.0
9:41:53 AM: - pinia 2.1.7
9:41:53 AM: - tailwindcss 3.3.3
9:41:53 AM: - unplugin-auto-import 0.16.6
9:41:53 AM: - unplugin-icons 0.17.1
9:41:53 AM: - unplugin-vue-components 0.25.2
9:41:53 AM: - unplugin-vue-macros 2.6.1
9:41:53 AM: - vite 4.5.0
9:41:53 AM: - vite-plugin-pages 0.31.0
9:41:53 AM: - vite-plugin-vue-layouts 0.8.0
9:41:53 AM: - vue 3.3.6
9:41:53 AM: - vue-i18n 9.5.0
9:41:53 AM: - vue-router 4.2.5
9:41:53 AM: devDependencies:
9:41:53 AM: - @pinia/testing 0.1.3
9:41:53 AM: - @types/node 20.8.7
9:41:53 AM: - @vitejs/plugin-vue 4.4.0
9:41:53 AM: - @vue/compiler-sfc 3.3.6
9:41:53 AM: - @vue/test-utils 2.4.1
9:41:53 AM: - ts-node 10.9.1
9:41:53 AM: - vitepress 1.0.0-rc.23
9:41:53 AM: - vue-tsc 1.8.19
9:41:53 AM: undefined
9:41:53 AM:  ENOENT  ENOENT: no such file or directory, open "/opt/build/.pnpm-store/v3/files/fa/4e2975982cd6a88cf8e5244a3c7de9888ab17b266f9f5ebc5a2abfc48a3b4ebba8103e676b3f742cc98a3fd985d41cb36ce54c081129f7a288b9bc3d0daabf-index.json"
9:41:53 AM: Error during pnpm install
9:41:53 AM: Build was terminated: dependency_installation script returned non-zero exit code: 1
9:41:53 AM: Failing build: Failed to install dependencies
9:41:53 AM: Finished processing build request in 18.496s

Add here is my package.json.

{
 "name": "dozzle",
 "version": "5.1.0",
 "description": "Realtime log viewer for docker containers. ",
 "homepage": "https://github.com/amir20/dozzle#readme",
 "bugs": {
  "url": "https://github.com/amir20/dozzle/issues"
 },
 "packageManager": "pnpm@8.9.2",
 "repository": {
  "type": "git",
  "url": "git+https://github.com/amir20/dozzle.git"
 },
 "license": "ISC",
 "author": "Amir Raminfar <findamir@gmail.com>",
 "scripts": {
  "watch:frontend": "vite --open http://localhost:3100/",
  "watch:backend": "LIVE_FS=true DEV=true DOZZLE_ADDR=localhost:3100 reflex -c .reflex",
  "dev": "concurrently --kill-others \"npm:watch:*\"",
  "build": "vite build",
  "preview": "LIVE_FS=true DOZZLE_ADDR=localhost:3100 reflex -c .reflex",
  "release": "bumpp",
  "test": "TZ=UTC vitest",
  "typecheck": "vue-tsc --noEmit",
  "docs:dev": "vitepress dev docs --open",
  "docs:build": "vitepress build docs",
  "docs:preview": "vitepress preview docs"
 },
 "dependencies": {
  "@iconify-json/carbon": "^1.1.21",
  "@iconify-json/cil": "^1.1.5",
  "@iconify-json/mdi": "^1.1.55",
  "@iconify-json/mdi-light": "^1.1.7",
  "@iconify-json/octicon": "^1.1.49",
  "@iconify-json/ph": "^1.1.6",
  "@intlify/unplugin-vue-i18n": "^1.4.0",
  "@vueuse/components": "^10.5.0",
  "@vueuse/core": "^10.5.0",
  "@vueuse/integrations": "^10.5.0",
  "@vueuse/math": "^10.5.0",
  "@vueuse/router": "^10.5.0",
  "ansi-to-html": "^0.7.2",
  "autoprefixer": "^10.4.16",
  "d3-array": "^3.2.4",
  "d3-ease": "^3.0.1",
  "d3-scale": "^4.0.2",
  "d3-selection": "^3.0.0",
  "d3-shape": "^3.2.0",
  "d3-transition": "^3.0.1",
  "daisyui": "^3.9.3",
  "date-fns": "^2.30.0",
  "entities": "^4.5.0",
  "fuse.js": "^6.6.2",
  "lodash.debounce": "^4.0.8",
  "pinia": "^2.1.7",
  "postcss": "^8.4.31",
  "postcss-mixins": "^9.0.4",
  "splitpanes": "^3.1.5",
  "tailwindcss": "^3.3.5",
  "unplugin-auto-import": "^0.16.6",
  "unplugin-icons": "^0.17.1",
  "unplugin-vue-components": "^0.25.2",
  "unplugin-vue-macros": "^2.6.1",
  "vite": "4.5.0",
  "vite-plugin-pages": "^0.31.0",
  "vite-plugin-vue-layouts": "^0.8.0",
  "vue": "^3.3.7",
  "vue-i18n": "^9.5.0",
  "vue-router": "^4.2.5"
 },
 "devDependencies": {
  "@iconify-json/ic": "^1.1.14",
  "@pinia/testing": "^0.1.3",
  "@playwright/test": "^1.39.0",
  "@types/d3-array": "^3.0.9",
  "@types/d3-ease": "^3.0.1",
  "@types/d3-scale": "^4.0.6",
  "@types/d3-selection": "^3.0.8",
  "@types/d3-shape": "^3.1.4",
  "@types/d3-transition": "^3.0.6",
  "@types/lodash.debounce": "^4.0.8",
  "@types/node": "^20.8.9",
  "@types/semver": "^7.5.4",
  "@vitejs/plugin-vue": "4.4.0",
  "@vue/compiler-sfc": "^3.3.7",
  "@vue/test-utils": "^2.4.1",
  "bumpp": "^9.2.0",
  "c8": "^8.0.1",
  "concurrently": "^8.2.2",
  "eventsourcemock": "^2.0.0",
  "jest-serializer-vue": "^3.1.0",
  "jsdom": "^22.1.0",
  "lint-staged": "^15.0.2",
  "prettier": "^3.0.3",
  "prettier-plugin-tailwindcss": "^0.5.6",
  "simple-git-hooks": "^2.9.0",
  "ts-node": "^10.9.1",
  "typescript": "^5.2.2",
  "vitepress": "1.0.0-rc.24",
  "vitest": "^0.34.6",
  "vue-tsc": "^1.8.21"
 },
 "lint-staged": {
  "*.{js,vue,css,ts,html,md}": [
   "prettier --write"
  ]
 },
 "simple-git-hooks": {
  "pre-commit": "pnpm lint-staged"
 }
}

Every time I clear cache it works, then immiedtly fails for any subsequent builds.

Hi @amir20 , thanks for the feedback.
The problem seems to be a pnpm problem.
Therefore kindly check the official pnpm GitHub issues pages below and then follow the suggestions there since the problem is similar.

hmm still no luck. Based on those, the problem seems to be related with containers and doing hard links which is something PNPM uses.

Is there a way to disable the store cache in Netlify? I don’t know what else to try.

What? That’s doesn’t help at all.

Hello @amir20 , at this point it would be appropriate if you also asked for help on the official pnpm GitHub issues page at Issues · pnpm/pnpm · GitHub
Thanks.

I have searched all the issues. Most folks suggest to clear store. But netlify doesn’t allow that because the there is no hook before pnpm install and then store is created at the end.

I don’t feel like my project is any different and I copied it from other Vue based projects.

I will search more but at some point I think I am going to give up and move to Github pages. On GH, I have exactly the same setup to test pnpm and never seen this error. Therefore, I think this is with Netlify and the way the containers are setup.

Thanks for the help.

You can always delete Netlify’s cache from your build by building a build plugin: Create Build Plugins | Netlify Docs, but I agree with @clarnx, this sounds more of a pnpm issue than a Netlify one.

1 Like

I think building a plugin is a good idea. But at some point, I had limited time and at this point I have moved to GH pages. I have more control there and the cache seems to be “just working”.

I did a lot of searching pnpm and netlify with no luck. If I had access to Netlify enviroment, it might have been easier.