简体   繁体   中英

Why won't node.js work for me across any of my applications? ELIFECYCLE error

Every application I run gets the same error message: ELIFECYCLE

Here is my error message:

 > pwd@1.0.0 start /Users/test/Desktop/test > server.js sh: server.js: command not found npm ERR. code ELIFECYCLE npm ERR. syscall spawn npm ERR: file sh npm ERR. errno ENOENT npm ERR. pwd@1.0.0 start. `server.js` npm ERR: spawn ENOENT npm ERR. npm ERR. Failed at the pwd@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! /Users/test/.npm/_logs/2020-08-22T14_40_02_505Z-debug.log Andrews-iMac:test test$

在此处输入图像描述

I threw up this super basic application to test whether it was happening across all of my projects. Clearly it is. Any ideas as to how to resolve?

Your start script needs to indicate you want to run node , it's not implied, since technically you can run any command in there

"start": "node server.js"

Could you try editing your start script to be

node server.js

Or even just run this command on your terminal.

This is how you use node.js to create a runtime environment for your js file

In your package.json, I noticed your start script only has “server.js” in it. You might have to write

“start”: “node server.js”

As your start script in order for it to work

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM