无法访问 npm [英] Unable to access npm

查看:83
本文介绍了无法访问 npm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照 这里

I installed node(which internally installs npm) offline following instructions from here

返回节点-

$ node -v
v10.22.0

但是 npm 失败了 -

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?

我尝试了来自 https://stackoverflow.com/a/45348862/1471417 的解决方案,但没有成功.>

I tried solution from https://stackoverflow.com/a/45348862/1471417 but no luck.

推荐答案

假设你使用的是 linux,请试试这个:

Suppose you are on linux, please try this :

sudo apt-get remove nodejs
sudo apt-get install nodejs

或者你可以尝试用 npm 重新安装 npm 如果这部分 npm 没有损坏:

or you can try to reinstall npm with npm if this part of npm is not broken :

npm i -g npm

这篇关于无法访问 npm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆