user1104028
user1104028

Reputation: 393

npm version check not working on macOS Sequoia 15.1

It seems npm is not working properly on my Mac running macOS Sequoia 15.1. If I attempt a version check via npm -v I am receiving these errors:

> internal/modules/cjs/loader.js:883   throw err;   ^

Error: Cannot find module 'node:path' Require stack:
- /usr/local/lib/node_modules/npm/lib/cli.js
- /usr/local/lib/node_modules/npm/bin/npm-cli.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/lib/cli.js:2:18)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19) {   code: 'MODULE_NOT_FOUND',   requireStack: [
    '/usr/local/lib/node_modules/npm/lib/cli.js',
    '/usr/local/lib/node_modules/npm/bin/npm-cli.js'   ]

}

Any ideas?

Upvotes: 0

Views: 407

Answers (1)

NSS
NSS

Reputation: 37

I don't think it has anything to do with your MacOS but there can be several reasons why you've encountered this problem:

  1. Maybe your node version isn't compatible with your npm. Try updating it first. In future, you might want to switch to nvm to use commands like this:
nvm install stable
nvm use stable

to make sure you're running a stable version of Node.

  1. If that doesn't help I suggest clearing the npm cache:
npm cache clean --force
  1. If that doesn't help either, just reinstall Node altogether.

Upvotes: 0

Related Questions