0

I can't do npm install on Windows in my application in Angular 8, because I get error:

C:\Repository\Tools\Tools\ClientApp>npm install
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module 'update-notifier'
npm ERR! Require stack:
npm ERR! - C:\Users\xxx\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\xxx\AppData\Roaming\npm-cache\_logs\2021-02-19T13_09_42_358Z-debug.log

in log file:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\xxx\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install'
1 verbose cli ]
2 info using npm@6.14.11
3 info using node@v14.15.5
4 verbose stack Error: Cannot find module 'update-notifier'
4 verbose stack Require stack:
4 verbose stack - C:\Users\xxx\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
4 verbose stack     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
4 verbose stack     at Function.Module._load (internal/modules/cjs/loader.js:725:27)
4 verbose stack     at Module.require (internal/modules/cjs/loader.js:952:19)
4 verbose stack     at require (internal/modules/cjs/helpers.js:88:18)
4 verbose stack     at EventEmitter.<anonymous> (C:\Users\xxx\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js:87:22)
4 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:75:11)
5 verbose cwd C:\Repository\Tools.xxx\Tools.xxx\ClientApp
6 verbose Windows_NT 10.0.17763
7 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\xxx\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install"
8 verbose node v14.15.5
9 verbose npm  v6.14.11
10 error code MODULE_NOT_FOUND
11 error Cannot find module 'update-notifier'
11 error Require stack:
11 error - C:\Users\xxx\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
12 verbose exit [ 1, true ]

Any other command that I try to call causes the same result, for example:

npm i -g npm-upgrade
npm cache clean
npm install -g update-notifier

Error occured when I try to update npm to version 7. Now I uninstall version 7 and there is version 6.14.11 as it was at the begin, but I still can't call npm install


I uninstalled Node.js and installed again but didn't help


In folder:

C:\Users\xxx\AppData\Roaming\npm\node_modules\npm

I have package.json file and inside this file:

"bin": {
    "npm": "./bin/npm-cli.js",
    "npx": "./bin/npx-cli.js"
  },
  "dependencies": {
    "update-notifier": "^2.5.0",

I tried to remove this line but result is the same, cannot find module update-notifier

Robert
  • 2,571
  • 10
  • 63
  • 95

1 Answers1

0

I found solution in this question: npm-cli-js-not-found

Copy the directory named npm from your installed node path (In my case the npm directory was available in C:\Program Files\nodejs\node_modules).

Navigate to C:\Users\%USERNAME%\AppData\Roaming\npm\node_modules and paste the copied npm directory there.

Robert
  • 2,571
  • 10
  • 63
  • 95