I'm trying to install packages for a work repo, however whenever I try to run the install, once it gets to the child processes (like running install scripts for a package) I get a weird spawn error. I'm assuming it's having issues running the child processes.
Some information:
It was working fine just last week, now suddenly I can't get anything done. I've tried the following:
node_modules and package-locknpm cache clear --force and npm cache verifyThe error I see is:
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn =
npm ERR! file =
npm ERR! path =
npm ERR! errno ENOENT
npm ERR! root@ prepare: `husky install`
npm ERR! spawn = ENOENT
npm ERR!
npm ERR! Failed at the root@ prepare script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\dhers\AppData\Roaming\npm-cache\_logs\2021-07-19T18_28_56_807Z-debug.log
Do note this is NOT a husky problem, anything that runs a child process script seems to have this error happen.
I've never seen this before and I'm unable to fix it with the googling I've done. Here is some information from the npm log:
59 silly lifecycle root@~prepare: Args: [ '-c', 'husky install' ]
60 info lifecycle root@~prepare: Failed to exec prepare script
61 silly lifecycle root@~prepare: Returned: code: -4058 signal: null
62 info lifecycle root@~prepare: Failed to exec prepare script
63 verbose stack Error: root@ prepare: `husky install`
63 verbose stack spawn = ENOENT
63 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:268:19)
63 verbose stack at onErrorNT (internal/child_process.js:470:16)
63 verbose stack at processTicksAndRejections (internal/process/task_queues.js:84:21)
64 verbose pkgid root@
65 verbose cwd C:\Users\dhers\Documents\Development\Work\seamless
66 verbose Windows_NT 10.0.19042
67 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "i"
68 verbose node v12.22.3
69 verbose npm v6.14.13
Has anyone seen this before? I'm really hoping I'm just overlooking something super simple. Any help would be appreciated because this has me halted right now.
Make sure your system environment variables PATH contains the following values:
%SystemRoot%
%SystemRoot%\system32
%SystemRoot%\System32\Wbem
C:\Program Files\nodejs\
Also, make sure your User environment variables PATH contains the following value:
C:\Users\dhers\AppData\Roaming\npm
Note that you need to restart your computer for the changes to take effect.
Maybe try the following:
npm cachenpm cache clean --force
npm install -g npm@latest
huskeyhuskey install through addingexport HUSKY_SKIP_INSTALL=true
to the npm install cmd just to see whether the problem persists with other prepare scripts.
Add the script to the postinstall hook instead of the prepare hook to see if the problem is from the hook.
Go up level by level in your working directory and make sure there are no other directories containing /node_modules directory or package.json or a pakcage-lock.json file. Sometimes npm considers it the root of the project.
Delete package-lock.json and node_modules
Execute npm cache clean --force
Execute npm install or yarn install
Then again run
maybe the wrong is your dependencies, check in your package.json and your npm local is not the correct
"dependencies": {
"npm": "^7.5.6",
then you can try with yarn, yarn install