'npm command fails after reinstalling windows 10
I have reinstalled Windows and since then, I cannot use npm, I always face the following bug.
I have tried reinstalling node, switching its versions but the npm commands keeps failing.
$ npm
node:internal/modules/cjs/loader:933
const err = new Error(message);
^
Error: Cannot find module './utils/unsupported.js'
Require stack:
- C:\Users\Guillaume\AppData\Roaming\npm\node_modules\npm\lib\cli.js
- C:\Users\Guillaume\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
←[90m at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)←[39m
←[90m at Function.Module._load (node:internal/modules/cjs/loader:778:27)←[39m
←[90m at Module.require (node:internal/modules/cjs/loader:999:19)←[39m
←[90m at require (node:internal/modules/cjs/helpers:102:18)←[39m
at module.exports (C:\Users\Guillaume\AppData\Roaming\npm\node_modules\←[4mnpm←[24m\lib\cli.js:14:59)
at Object.<anonymous> (C:\Users\Guillaume\AppData\Roaming\npm\node_modules\←[4mnpm←[24m\bin\npm-cli.js:2:25)
←[90m at Module._compile (node:internal/modules/cjs/loader:1099:14)←[39m
←[90m at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)←[39m
←[90m at Module.load (node:internal/modules/cjs/loader:975:32)←[39m
←[90m at Function.Module._load (node:internal/modules/cjs/loader:822:12)←[39m {
code: ←[32m'MODULE_NOT_FOUND'←[39m,
requireStack: [
←[32m'C:\\Users\\Guillaume\\AppData\\Roaming\\npm\\node_modules\\npm\\lib\\cli.js'←[39m,
←[32m'C:\\Users\\Guillaume\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js'←[39m
]
}
Node.js v17.8.0
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
