Reputation: 75
I have a problem starting a node.js server. The server app was tested on another system and worked perfectly. The error log says that something is wrong with the node-api@ but I was not able to find any solution.
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info prestart node-api@
6 info start node-api@
7 verbose unsafe-perm in lifecycle true
8 info node-api@ Failed to exec start script
9 verbose stack Error: node-api@ start: `node server.js`
9 verbose stack Exit status 1
9 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:213:16)
9 verbose stack at EventEmitter.emit (events.js:110:17)
9 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
9 verbose stack at ChildProcess.emit (events.js:110:17)
9 verbose stack at maybeClose (child_process.js:1015:16)
9 verbose stack at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
10 verbose pkgid node-api@
11 verbose cwd /Volumes/HDD/Users/…/app/db
12 error Darwin 14.3.0
13 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
14 error node v0.12.3
15 error npm v2.9.1
16 error code ELIFECYCLE
17 error node-api@ start: `node server.js`
17 error Exit status 1
18 error Failed at the node-api@ start script 'node server.js'.
18 error This is most likely a problem with the node-api package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error node server.js
18 error You can get their info via:
18 error npm owner ls node-api
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]
What is wrong with my installation and how can I solve this?
Upvotes: 5
Views: 36755
Reputation: 11
Clear the system cache and run the command in the terminal
npm cache clean --force
then
npm start
Upvotes: 1
Reputation: 1
I had something like that, and my mistake was that i do not have permission of access to the folders, so i was using Manjaro and i run my app with
sudo npm start
and that
Upvotes: 0
Reputation: 179
I reinstalled the webpack and it worked
"npm i --save-dev [email protected]"
Upvotes: 1
Reputation: 61
I wouldn't claim to entirely understand the solution. I think it had something to do with either incorrect addresses recorded to navigate node_modules, or it may have been my version of watchman was outdated or corrupted.
I fixed the issue by reinstalling watchman and deleting/recreating the node_modules
and package-lock.json
files.
npm cache clean --force
rm -rf node_modules
rm -rf package-lock.json
brew uninstall watchman
npm r -g watchman
npm install watchman
npm install
npm start
It's a long chain and a pretty uncertain answer; but after being stuck for a long time this is what got me past it.
Good luck.
Upvotes: 0
Reputation: 6178
I faced same problem. For my case, I it occurred after adding following line in my package.json file.
"scripts": {
"start": "node index.js"
}
After remove the start scripts it solved.
Now I am running my server by node index.js
Upvotes: 2
Reputation: 8500
I got this same error when I have compilation errors in my code. I've used npm start
Upvotes: 0
Reputation: 100
I got to this page looking for a solution to a similar error log.
My problem was that I had started the webpack dev server in the background and had forgotten to kill it before asking Node to start it up again.
Try to find the process PID (second column of output)
ps -u [your user name]
Then send the SIGINT signal (2) to the process with the PID
kill -2 [PID]
Hope this helps others that come to this page.
Upvotes: 8
Reputation: 1950
Two things you can try here:
node -v
. If they're different, look to upgrade (or indeed downgrade) your installation.node_modules
directory from the project root on your current computer, then run an npm install
to ensure that the binaries that were compiled are compatible with your operating system.Upvotes: 10