0

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'   ] }
  • Node.js Version: v14.17.1
  • OS: Windows 10

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?

RobC
  • 22,977
  • 20
  • 73
  • 80
sameer
  • 23
  • 1
  • 4

1 Answers1

0

Uninstall NodeJS, then delete the C:\Program Files\nodejs directory, and finally reinstall NodeJS.

Shivam
  • 1,345
  • 7
  • 28
  • As mentioned above i tried uninstalling node.js but getting error "The installer has encountered an unexpected error installing this package, this may indicate a problem with this package. The error code is 2330 " and then uninstalling is also rolled back, same for installing new without uninstalling this one – sameer Jul 23 '21 at 17:24
  • I know, but I meant to run the uninstaller even if it gives the error. – Shivam Jul 23 '21 at 17:25
  • I didn't get you, the uninstall process is automatically terminated because of the error mentioned above – sameer Jul 23 '21 at 17:28
  • Then don't uninstall it. Just delete the directory. – Shivam Jul 23 '21 at 17:30
  • Was not able to un-install but renamed nodejs directory in program files and installed new node.js version, but any suggestion to avoid this type of issue in future Or what causes this type of issue – sameer Jul 23 '21 at 18:02
  • It's probably some invalid files or a corrupted installation. – Shivam Jul 24 '21 at 12:57