Cannot find module '../lib/utils/unsupported.js'

运行npm run clean出错:

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

Error: Cannot find module '../lib/utils/unsupported.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:594:15)
    at Function.Module._load (internal/modules/cjs/loader.js:520:25)
    at Module.require (internal/modules/cjs/loader.js:650:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at /usr/local/lib/node_modules/npm/bin/npm-cli.js:19:21
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:153:3)
    at Module._compile (internal/modules/cjs/loader.js:702:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
    at Module.load (internal/modules/cjs/loader.js:612:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)

解决办法:

sudo rm -rf /usr/local/lib/node_modules/npm

先把之前的文件删除

userdeMBP:~ user$ brew uninstall --force node
Error: Refusing to uninstall /usr/local/Cellar/node/11.1.0
because it is required by yarn, which is currently installed.
You can override this and force removal with:
  brew uninstall --ignore-dependencies node

然后再删除node,因为我有安装yarn,所以使用--ignore-dependencies:

userdeMBP:~ user$ brew uninstall --ignore-dependencies node
Uninstalling /usr/local/Cellar/node/11.1.0... (3,936 files, 47.0MB)
node 9.10.1 is still installed.
Remove all versions with `brew uninstall --force node

然后再安装:

userdeMacBook-Pro:~ user$ brew install node
==> Downloading https://homebrew.bintray.com/bottles/node-11.1.0.mojave.bottle.t
Already downloaded: /Users/user/Library/Caches/Homebrew/downloads/2d71518883b6f6ce458778abea35981525ecdee4a14408431b9f42ed132015e1--node-11.1.0.mojave.bottle.tar.gz
==> Pouring node-11.1.0.mojave.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> Summary
?  /usr/local/Cellar/node/11.1.0: 3,936 files, 47.0MB

然后就成功了:

userdeMacBook-Pro:~ user$ npm

Usage: npm <command>

where <command> is one of:
...

 

转载于:https://www.cnblogs.com/wanghui-garcia/p/9947347.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值