0

Answers to similar questions here and here do not resolve my issue.

In an empty directory I create a file 'server.js' all it does is a console.log('hello'). Running this file with "node server.js" runs fine. But after "npm init -y" running through "npm start" gives:

npm start  
The system cannot find the path specified.

> prj@1.0.0 start E:\projects\prj
> node server.js

/bin/bash: node: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file bash
npm ERR! errno ENOENT
npm ERR! prj@1.0.0 start: `node server.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the prj@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

The detailed logfile reports correct versions of npm and node. And all of this is after an uninstall/reinstall of node.js.

Any hints on how to troubleshoot/fix appreciated.

project directory:

E:\prj
 package.json
 package-lock.json
 server.js   

package.json is the default after npm init:

{
 "name": "prj",
 "version": "1.0.0",
 "description": "",
 "main": "server.js",
 "scripts": {
   "test": "echo \"Error: no test specified\" && exit 1",
   "start": "node server.js"
   },
 "keywords": [],
 "author": "",
 "license": "ISC"
}
Robert Altena
  • 787
  • 2
  • 11
  • 26
  • "/bin/bash: node: command not found" is probably an indication that node is not found. Maybe it's got something to do with your environment variables. It seems that the terminal is able to find node but npm is somehow not able to? – Winston Jude Apr 24 '20 at 13:11
  • Did you tried running node server.js from your editor terminal? – Niraj Patel Apr 24 '20 at 13:13

0 Answers0