npm start giving error in node.js

2020-06-23 07:59发布

i am totally new to node.js and mongodb. I am using the following link: http://cwbuecheler.com/web/tutorials/2013/node-express-mongo/ This procedure worked very fine and got the exact same results. But all of a sudden "npm start" stopped working. I uninstalled every thing and trying to re-install from step 1 given in this tutorial. when i give the command "npm install -g express" i am not getting any list of http 304's and GETS!! . As i ignore and continue the procedure, i give the command npm start , but it does not work. the error displayed is shown below C:\project\nodetest1>npm start

  > nodetest1@0.0.0 start C:\project\nodetest1
  > node ./bin/www


   npm ERR! nodetest1@0.0.0 start: `node ./bin/www`
   npm ERR! spawn ENOENT
   npm ERR!
   npm ERR! Failed at the nodetest1@0.0.0 start script.
   npm ERR! This is most likely a problem with the nodetest1 package,
   npm ERR! not with npm itself.
   npm ERR! Tell the author that this fails on your system:
   npm ERR!     node ./bin/www
   npm ERR! You can get their info via:
   npm ERR!     npm owner ls nodetest1
   npm ERR! There is likely additional logging output above.
   npm ERR! System Windows_NT 6.1.7601
   npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
  npm ERR! cwd C:\project\nodetest1
  npm ERR! node -v v0.10.33
  npm ERR! npm -v 1.4.28
  npm ERR! syscall spawn
  npm ERR! code ELIFECYCLE
  npm ERR! errno ENOENT
  npm ERR! nodetest1@0.0.0 start: `node ./bin/www`
  npm ERR! Exit status -1
  npm ERR!
  npm ERR! Failed at the nodetest1@0.0.0 start script.
  npm ERR! This is most likely a problem with the nodetest1 package,
  npm ERR! not with npm itself.
  npm ERR! Tell the author that this fails on your system:
  npm ERR!     node ./bin/www
  npm ERR! You can get their info via:
  npm ERR!     npm owner ls nodetest1
  npm ERR! There is likely additional logging output above.

  npm ERR! System Windows_NT 6.1.7601
  npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\ProgramFiles\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
  npm ERR! cwd C:\project\nodetest1
  npm ERR! node -v v0.10.33
  npm ERR! npm -v 1.4.28
  npm ERR! code ELIFECYCLE
  npm ERR!
  npm ERR! Additional logging details can be found in:
  npm ERR!     C:\project\nodetest1\npm-debug.log
  npm ERR! not ok code 0

Please help . Thanks in advance.

标签: node.js npm
4条回答
Melony?
2楼-- · 2020-06-23 08:32

The package.json is telling npm that start means "run node ./bin/www". **but packege.json predefined staring script is npm run serve **

please try this one.

npm run serve

"start": "concurrently \"npm run build:watch\" \"npm run serve\""

查看更多
Deceive 欺骗
3楼-- · 2020-06-23 08:36

The error suggests that the ./bin/www directory is not found. Paths specified with a dot are relative to the current directory, so your current directory has to be C:/project/nodetest1 for npm start to work in this case.

查看更多
女痞
4楼-- · 2020-06-23 08:42

There are several issues here.

First, you should upgrade to a newer npm, as the npm that ships with even the latest version of node is out of date. To upgrade npm on Windows, follow the instructions here: https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows

Second, you may need to do some more troubleshooting on your own to find the problem. npm start just follows the instructions in the package.json. The package.json is telling npm that start means "run node ./bin/www".

What happens when you run that same script from the command line?

cd C:\project\nodetest1 node ./bin/www

Does the file 'bin/www' exist? Is node installed and in your path? These are the issues that you will have to troubleshoot.

查看更多
疯言疯语
5楼-- · 2020-06-23 08:44

Delete the node_modules folder. Run npm install And then, re-run your command npm start

查看更多
登录 后发表回答