I'm facing an npm issue while utilizing the npm install
and npm -v
commands.
Below is the error log for the npm -v
command when run in Windows Command Prompt:
C:\Users\Sameer>npm -v internal/modules/cjs/loader.js:905 throw err; ^ Error: Cannot find module './config/core.js' Require stack: - C:\Program Files\nodejs\node_modules\npm\lib\npm.js - C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15) at Function.Module._load (internal/modules/cjs/loader.js:746:27) at Module.require (internal/modules/cjs/loader.js:974:19) at require (internal/modules/cjs/helpers.js:92:18) at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:25:17 at Object.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:502:3) at Module._compile (internal/modules/cjs/loader.js:1085:14) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10) at Module.load (internal/modules/cjs/loader.js:950:32) at Function.Module._load (internal/modules/cjs/loader.js:790:14) { code: 'MODULE_NOT_FOUND', requireStack: [ 'C:\\Program Files\\nodejs\\node_modules\\npm\\lib\\npm.js', 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js' ] } internal/modules/cjs/loader.js:905 throw err; ^ Error: Cannot find module './config/core.js' Require stack: - C:\Program Files\nodejs\node_modules\npm\lib\npm.js - C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15) at Function.Module._load (internal/modules/cjs/loader.js:746:27) at Module.require (internal/modules/cjs/loader.js:974:19) at require (internal/modules/cjs/helpers.js:92:18) at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:25:17 at Object.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:502:3) at Module._compile (internal/modules/cjs/loader.js:1085:14) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10) at Module.load (internal/modules/cjs/loader.js:950:32) at Function.Module._load (internal/modules/cjs/loader.js:790:14) { code: 'MODULE_NOT_FOUND', requireStack: [ 'C:\\Program Files\\nodejs\\node_modules\\npm\\lib\\npm.js', 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js' ] }
I tried uninstalling node.js, and also tried installing the new node.js setup directly. However, I'm getting the below error on windows system when uninstalling and installing the node.js rollbacks:
Node.js uninstall/install error in windows system
Node.js
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2330.
Any workarounds or suggestion to solve this type of issues with npm? Or any way to uninstall node.js and install a new version?
Uninstall NodeJS, then delete the C:\Program Files\nodejs
directory, and finally reinstall NodeJS.