问题
I installed node
(which internally installs npm
) offline following instructions from here
Node is returned -
$ node -v
v10.22.0
But npm failed -
$ npm --version
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module '../lib/utils/unsupported.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at /opt/node-v10.22.0-linux-x64/bin/npm:19:21
at Object.<anonymous> (/opt/node-v10.22.0-linux-x64/bin/npm:155:3)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
Could you help to understand how to resolve this?
I tried solution from https://stackoverflow.com/a/45348862/1471417 but no luck.
回答1:
will this help ?
sudo apt-get install --reinstall nodejs
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
回答2:
Suppose you are on linux, please try this :
sudo apt-get remove nodejs
sudo apt-get install nodejs
or you can try to reinstall npm with npm if this part of npm is not broken :
npm i -g npm
来源:https://stackoverflow.com/questions/63938024/unable-to-access-npm