简体   繁体   English

npm安装的错误为“ console.error(`已知会破坏npm的错误。”

[英]The error of npm install as ''console.error(`a bug known to break npm. "

Followed by this post , I have already installed the Node.JS (9.4.0). 在这篇文章之后 ,我已经安装了Node.JS(9.4.0)。

$brew install node      
$node -v                                                                                   
$v0.12.7

Then, npm install -g grunt-cli for test. 然后, npm install -g grunt-cli进行测试。 The error shows like this: 错误显示如下:

/usr/local/lib/node_modules/npm/lib/utils/unsupported.js:28
        console.error(`a bug known to break npm. Please update to at least ${r
                      ^
SyntaxError: Unexpected token ILLEGAL
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    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:92:3)
    at Module._compile (module.js:460:26)

I don't know the erro here, and how to fix it. 我不知道这里的错误以及如何解决。

Any comments would be appreciated 任何意见将不胜感激

You're using an old version of Node.js which doesn't support template literals. 您正在使用不支持模板文字的旧版Node.js。

Upgrade Node to the latest version and you'll be fine. 将Node升级到最新版本 ,就可以了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM