how to solve npm error “npm ERR! errno 9009” at dev: `lite-server`

2.6k Views Asked by At

So, I was starting to learn bootstrap and for that I had to install and configure node & npm to run lite-server I've already created my .json file and installed lite server using command "npm install lite-server --save-dev" then after adding "dev": "lite-server" to the script of json file and try to run the command "npm run dev" then this error came in.

$ npm run dev

> [email protected] dev C:\Users\Shahir K\Desktop\bootstrapcourse
> lite-server

'"node"' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 9009
npm ERR! [email protected] dev: `lite-server`
npm ERR! Exit status 9009
npm ERR!
npm ERR! Failed at the [email protected] dev 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!     C:\Users\Shahir K\AppData\Roaming\npm-cache\_logs\2020-09-01T04_38_50_640Z-debug.log

can anyone explain this issue please I'll provide my json file and log file below

{
  "name": "bootstrapcourse",
  "version": "1.0.0",
  "description": "first bootstrap course work to create package.jason \u001b[D\u001b[D\u001b[D\u001b[\u001b[C\u001b[C\u001b[son file",
  "main": "index.html",
  "scripts": {
    "dev": "lite-server",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/shaheerk48/bootstrapworkrepo.git"
  },
  "author": "shahir",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/shaheerk48/bootstrapworkrepo/issues"
  },
  "homepage": "https://github.com/shaheerk48/bootstrapworkrepo#readme",
  "devDependencies": {
    "lite-server": "^2.5.4"
  }
}

log file ->

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'D:\\NODE\\node.exe',
1 verbose cli   'D:\\NODE\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'dev'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle [email protected]~predev: [email protected]
6 info lifecycle [email protected]~dev: [email protected]
7 verbose lifecycle [email protected]~dev: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~dev: PATH: D:\NODE\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Shahir K\Desktop\bootstrapcourse\node_modules\.bin;C:\Users\Shahir K\bin;D:\Git\mingw64\bin;D:\Git\usr\local\bin;D:\Git\usr\bin;D:\Git\usr\bin;D:\Git\mingw64\bin;D:\Git\usr\bin;C:\Users\Shahir K\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Java\jdk-13.0.1\bin;C:\Program Files\dotnet;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;D:\Git\cmd;.;C:\Program Files\Java\jdk-13.0.1\bin";C:\PHP7;D:\NODE;D:\NODE\node_modules\npm\bin;C:\Users\Shahir K\AppData\Local\Microsoft\WindowsApps;C:\Users\Shahir K\AppData\Local\Programs\Microsoft VS Code\bin;C:\MinGW\bin;C:\Users\Shahir K\AppData\Roaming\npm;D:\Git\usr\bin\vendor_perl;D:\Git\usr\bin\core_perl
9 verbose lifecycle [email protected]~dev: CWD: C:\Users\Shahir K\Desktop\bootstrapcourse
10 silly lifecycle [email protected]~dev: Args: [ '/d /s /c', 'lite-server' ]
11 silly lifecycle [email protected]~dev: Returned: code: 9009  signal: null
12 info lifecycle [email protected]~dev: Failed to exec dev script
13 verbose stack Error: [email protected] dev: `lite-server`
13 verbose stack Exit status 9009
13 verbose stack     at EventEmitter.<anonymous> (D:\NODE\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess.<anonymous> (D:\NODE\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid [email protected]
15 verbose cwd C:\Users\Shahir K\Desktop\bootstrapcourse
16 verbose Windows_NT 10.0.18363
17 verbose argv "D:\\NODE\\node.exe" "D:\\NODE\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
18 verbose node v12.18.3
19 verbose npm  v6.14.6
20 error code ELIFECYCLE
21 error errno 9009
22 error [email protected] dev: `lite-server`
22 error Exit status 9009
23 error Failed at the [email protected] dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 9009, true ]

1

There are 1 best solutions below

0
On

This error is specific to nodejs environment, you need to follow few steps to solve this, like

step 1 - clean npm cache, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid

npm cache clean --force

step 2 - delete node_modules and package-lock JSON, by deleting this it will remove the node_modules folder from your project.

rm -rf node_modules package-lock.json

step 3 - install dependencies again

npm install

step 4 - run your program

npm run dev