npm安装错误-SyntaxError:作用域声明

时间:2018-09-01 20:34:46

标签: node.js npm homebrew

我正在尝试安装create-react-app,但它引发了这个错误-

rem$ npm install -g create-react-app
Command failed: /bin/sh -c /usr/local/bin/node /usr/local/lib/node_modules/npm/bin/npm-cli.js config get cache --parseable
/usr/local/lib/node_modules/npm/bin/npm-cli.js:82
      let notifier = require('update-notifier')({pkg})
      ^^^

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:414:25)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Function.Module.runMain (module.js:467:10)
    at startup (node.js:136:18)
    at node.js:963:3

我同时更新了npm和node,但是仍然遇到相同的问题。

酿造升级npm 酿造升级节点

rem$ brew upgrade npm
Error: npm 10.9.0 already installed
rem$ brew upgrade node
Error: node 10.9.0 already installed

1 个答案:

答案 0 :(得分:0)

我在npm上遇到了类似的麻烦。尽管我有节点10,但它仍默认为node @ 4。然后我安装了nvm并使用它安装了特定的nodejs版本并使用了它。 在Mac上,

nextProps.navigation.state.param.data