Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm start fails because of node-api@ ELIFECYCLE

Tags:

node.js

npm

macos

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?

like image 983
AppleCoderXY Avatar asked May 14 '15 14:05

AppleCoderXY


People also ask

How to solve NPM error “NPM err code elifecycle”?

How to solve npm error “npm ERR! code ELIFECYCLE” Step 1: $ npm cache clean --force Step 2: Delete node_modules by $ rm -rf node_modules (rmdir /S /Q node_modules in windows) folder or delete it manually by going into the directory and right-click > delete / move to trash.

How do I delete node_modules in NPM?

/Users/ItsMeMrLi/.npm/_logs/2017-02-17T22_48_03_655Z- debug.log Show activity on this post. Step 2: Delete node_modules by $ rm -rf node_modules ( rmdir /S /Q node_modules in windows) folder or delete it manually by going into the directory and right-click > delete / move to trash.

How to fix npm package not installed issue?

First, clean the npm cache by using the following command. or you can delete it manually by right-clicking on it and select the delete option. Now, re-install the npm packages again by running the below command. Start the development server using the appropriate command, like npm start or npm run dev. It will work successfully without any errors.

How to fix NPM err error in react?

Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the todo_app package react, npm ERR! not with npm itself. This above error is occurred due to the node_modules folder is corrupted in your project, to fix it follow the below steps.


2 Answers

Two things you can try here:

  1. Ensure that you are running the same version of Node as the other system where it was seen running perfectly. You can test this by entering the following on your terminal and the terminal it was working on: node -v. If they're different, look to upgrade (or indeed downgrade) your installation.
  2. Delete the 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.
like image 84
Tom Hallam Avatar answered Oct 29 '22 23:10

Tom Hallam


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.

like image 43
Jack Avatar answered Oct 29 '22 21:10

Jack