palash
palash

Reputation: 539

npm run start, Failed at the start script

This is my first time using nodejs, I am getting the following error while running npm run start command. Is there a version compatibility issue between node and npm? I can see that the end lines suggesting this is not an issue with npm.

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/home/iamuser/.nvm/versions/node/v14.17.6/bin/node',
1 verbose cli   '/home/iamuser/.nvm/versions/node/v14.17.6/bin/npm',
1 verbose cli   'run',
1 verbose cli   'start'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: /home/iamuser/.nvm/versions/node/v14.17.6/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/iamuser/Documents/JS/rapid_api/test-api/node_modules/.bin:/home/iamuser/.nvm/versions/node/v14.17.6/bin:/home/iamuser/anaconda3/bin:/home/iamuser/anaconda3/condabin:/home/iamuser/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle [email protected]~start: CWD: /home/iamuser/Documents/JS/rapid_api/test-api
10 silly lifecycle [email protected]~start: Args: [ '-c', 'nodemon index.js' ]
11 info lifecycle [email protected]~start: Failed to exec start script
12 verbose stack Error: [email protected] start: `nodemon index.js`
12 verbose stack spawn ENOENT
12 verbose stack     at ChildProcess.<anonymous> (/home/iamuser/.nvm/versions/node/v14.17.6/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
12 verbose stack     at ChildProcess.emit (events.js:400:28)
12 verbose stack     at maybeClose (internal/child_process.js:1055:16)
12 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
13 verbose pkgid [email protected]
14 verbose cwd /home/iamuser/Documents/JS/rapid_api/test-api
15 verbose Linux 5.11.0-44-generic
16 verbose argv "/home/iamuser/.nvm/versions/node/v14.17.6/bin/node" "/home/iamuser/.nvm/versions/node/v14.17.6/bin/npm" "run" "start"
17 verbose node v14.17.6
18 verbose npm  v6.14.15
19 error code ELIFECYCLE
20 error syscall spawn
21 error file sh
22 error errno ENOENT
23 error [email protected] start: `nodemon index.js`
23 error spawn ENOENT
24 error Failed at the [email protected] start script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]

package.json:

{
  "name": "test-api",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "nodemon index.js"
  },
  "author": "iamuser",
  "license": "ISC",
  "dependencies": {
    "axios": "^0.24.0",
    "cheerio": "^1.0.0-rc.10",
    "express": "^4.17.1"
  }
}

Upvotes: 1

Views: 8463

Answers (1)

K.K Designs
K.K Designs

Reputation: 706

As @ndenasie said, nodemon isn't installed. Try running npm install -g nodemon then npm run start and it should work.

Upvotes: 5

Related Questions