Running npm start, npm run or npm run-script fails with npm ERR! errno 3221225781
My node is cleanly installed stable version 10.16.3 LTS
with npm 6.9.0
on Windows 10. Everything is installed on the default path on C:.
My example is a minimal setup with the current file structure:
node_modules/ <empty>
index.js
package.json
The node_modules folder is empty.
The index.js:
console.log("Hello world..");
The package.json:
{
"name": "testnpm",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"start": "node index.js"
}
}
Running npm start
H:\dev\javascript\testnpm>npm start
> testnpm@1.0.0 start H:\dev\javascript\testnpm
> node index.js
npm ERR! code ELIFECYCLE
npm ERR! errno 3221225781
npm ERR! testnpm@1.0.0 start: `node index.js`
npm ERR! Exit status 3221225781
npm ERR!
npm ERR! Failed at the testnpm@1.0.0 start 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! <Path to logs>\_logs\2019-10-19T13_24_15_158Z-debug.log
The expected output would be "Hello World.." but fails as shown above.
Running the same command directly gives the expected result:
H:\dev\javascript\testnpm>node index.js
Hello world..
Here's the log after failure:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start' ]
2 info using npm@6.9.0
3 info using node@v10.16.3
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle testnpm@1.0.0~prestart: testnpm@1.0.0
6 info lifecycle testnpm@1.0.0~start: testnpm@1.0.0
7 verbose lifecycle testnpm@1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle testnpm@1.0.0~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;H:\dev\javascript\testnpm\node_modules\.bin;...
9 verbose lifecycle testnpm@1.0.0~start: CWD: H:\dev\javascript\testnpm
10 silly lifecycle testnpm@1.0.0~start: Args: [ '-c', 'node index.js' ]
11 silly lifecycle testnpm@1.0.0~start: Returned: code: 3221225781 signal: null
12 info lifecycle testnpm@1.0.0~start: Failed to exec start script
13 verbose stack Error: testnpm@1.0.0 start: `node index.js`
13 verbose stack Exit status 3221225781
13 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:198:13)
13 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:198:13)
13 verbose stack at maybeClose (internal/child_process.js:982:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid testnpm@1.0.0
15 verbose cwd H:\dev\javascript\testnpm
16 verbose Windows_NT 10.0.18362
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v10.16.3
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 3221225781
22 error testnpm@1.0.0 start: `node index.js`
22 error Exit status 3221225781
23 error Failed at the testnpm@1.0.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 3221225781, true ]
To be clear, npm install
and such works. Starting a script with node
works fine too. The only thing not working is running any of the defined scripts in package.json
with npm
.
====================================
EDIT:
- Same error after updating npm with
npm i -g npm
- Clue: Error code 3221225781 just happens to be the code for missing dll in .NET
- I've uninstalled all development libraries, IDE's, distributables, and reinstalled only necessary according to install description from npm on github. Still same error.
- It works in Git Bash! But still same error in CMD and PowerShell. It made me suspect PATH, added all the Git Bash paths in CMD manually to try, and it's still the same error.
- Did a FULL Reinstall of Windows, ran the node install which now installs
chocolatey
and that in turn installs the following dependencies:
- chocolatey-dotnetfx.extension v1.0.1
- python2 v2.7.17
- kb3033929 v1.0.5
- visualstudio2017buildtools v15.9.17.0
- chocolatey-windowsupdate.extension v1.0.4
- vcredist140 v14.23.27820
- kb2999226 v1.0.20181019
- visualstudio-installer v2.0.1
- kb2919355 v1.0.20160915
- chocolatey-core.extension v1.3.3
- kb2919442 v1.0.20160915
- visualstudio2017-workload-vctools v1.3.2
- chocolatey-visualstudio.extension v1.8.1
- dotnetfx v4.8.0.20190930
- kb3035131 v1.0.3
- It now works, what the actual problem was will likely remain a mystery.