c12
c12 copied to clipboard
Install dependencies after cloning not working with pnpm-workspace
Environment
Node: v20.10.0 "nuxt": "^3.9.0", "vue": "^3.4.3", "vue-router": "^4.2.5"
Reproduction
Method1:
- https://github.com/Callan003/test-nuxt-layers
- run pnpm install - it will get stuck
- remove pnpm-workspace.yaml
- run pnpm install - it works
- optional: remove old node_modules and pnpm-lock between step 3 and 4 just to be sure it is a clean build
Method2:
- https://github.com/Callan003/test-nuxt-layers
- go to nuxt.config.ts
- remove { giget: { install: true } }
- run pnpm install - it works
- add { giget: { install: true } } back
- run pnpm install - it fails
- optional: remove old node_modules and pnpm-lock before running pnpm install
Describe the bug
When trying to use the new install feature with pnpm-workspace the project gets stuck on pnpm install.
I think it gets stuck on the following prompt: "The modules directory at "C:\Projects\test-nuxt-layers\a\node_modules" will be removed and reinstalled from scratch. Proceed? (Y/n)". Because running the "pnpm install" command will not 'answer' with a Y/n, the process gets stuck.
On bigger projects it will ask this prompt for each node_modules which will trigger the "MaxListenersExceededWarning: Possible EventEmmiter memory leak detected" warning. Like I mentioned here
I am not sure if it is a pnpm bug or a c12 bug, but it seems to be breaking only when using install: true and pnpm-workspace.yaml file
Additional context
No response
Logs
No response
@pi0 any guidance here? I'm attempting to solve this issue, and I would be grateful for any advice or tips you can offer. Thank-you!
Hi dear @Callan003 thanks for the nice reproduction and sorry for delay on this.
I have made upstream issue in nypm that handles downloading which by default it probably has to auto skip interactive prompts like this.
hi @pi0, there are 2 ways of bypassing confirm popup
first one will eagerly will force installation of the dependencies
pnpm install --force
in this case it ends in:
../../../a postinstall: sh: nuxi: command not found
│ ELIFECYCLE Command failed.
│ ../../../b postinstall: sh: nuxi: command not found
│ ../../.. postinstall: sh: nuxi: command not found
│ ERROR Command failed with exit code 1: corepack pnpm install
│ at makeError (node_modules/.pnpm/[email protected]/node_modules/execa/lib/error.js:60:11)
│ at handlePromise (node_modules/.pnpm/[email protected]/node_modules/execa/index.js:124:26)
│ at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
│ at async executeCommand (node_modules/.pnpm/[email protected]/node_modules/nypm/dist/index.mjs:43:3)
│ at async installDependencies (node_modules/.pnpm/[email protected]/node_modules/nypm/dist/index.mjs:169:3)
│ at async downloadTemplate (node_modules/.pnpm/[email protected]/node_modules/giget/dist/index.mjs:349:5)
│ at async resolveConfig (node_modules/.pnpm/[email protected]/node_modules/c12/dist/index.mjs:272:20)
│ at async extendConfig (node_modules/.pnpm/[email protected]/node_modules/c12/dist/index.mjs:225:21)
│ at async loadConfig (node_modules/.pnpm/[email protected]/node_modules/c12/dist/index.mjs:160:5)
│ at async loadNuxtConfig (node_modules/.pnpm/@[email protected]/node_modules/@nuxt/kit/dist/index.mjs:2546:18)
│ ERROR Command failed with exit code 1: corepack pnpm install
second involves setting terminal in CI mode and run install with config
export CI=1
pnpm install --config.confirmModulesPurge=false
In this case in ends in:
. postinstall: ../../../b postinstall: sh: /Users/maciej.jezierski/projects/test-nuxt-layers/node_modules/.bin/nuxi: Permission denied
. postinstall: ../../../a postinstall: sh: /Users/maciej.jezierski/projects/test-nuxt-layers/node_modules/.bin/nuxi: Permission denied
. postinstall: ELIFECYCLE Command failed.
. postinstall: [error] Command failed with exit code 1: corepack pnpm install
. postinstall: at makeError (node_modules/.pnpm/[email protected]/node_modules/execa/lib/error.js:60:11)
. postinstall: at handlePromise (node_modules/.pnpm/[email protected]/node_modules/execa/index.js:124:26)
. postinstall: at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
. postinstall: at async executeCommand (node_modules/.pnpm/[email protected]/node_modules/nypm/dist/index.mjs:43:3)
. postinstall: at async installDependencies (node_modules/.pnpm/[email protected]/node_modules/nypm/dist/index.mjs:169:3)
. postinstall: at async downloadTemplate (node_modules/.pnpm/[email protected]/node_modules/giget/dist/index.mjs:349:5)
. postinstall: at async resolveConfig (node_modules/.pnpm/[email protected]/node_modules/c12/dist/index.mjs:272:20)
. postinstall: at async extendConfig (node_modules/.pnpm/[email protected]/node_modules/c12/dist/index.mjs:225:21)
. postinstall: at async loadConfig (node_modules/.pnpm/[email protected]/node_modules/c12/dist/index.mjs:160:5)
. postinstall: at async loadNuxtConfig (node_modules/.pnpm/@[email protected]/node_modules/@nuxt/kit/dist/index.mjs:2546:18)
. postinstall: [error] Command failed with exit code 1: corepack pnpm install
I think in both cases we end up in situations where nuxi lacks permissions to be executed, but it's just assumption.