一:更新npm

  npm install npm@latest -g
  • 3.我的电脑出现了如下错误:
  C:\Users\lenovo\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js:79
        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:373:25)
      at Object.Module._extensions..js (module.js:416:10)
      at Module.load (module.js:343:32)
      at Function.Module._load (module.js:300:12)
      at Function.Module.runMain (module.js:441:10)
      at startup (node.js:139:18)
      at node.js:968:3
  • 4.在网上搜索了相关资料发现是node版本过低的原因,所以我们接下来更新node。

二:更新node

  • 1.到node官网(https://nodejs.org/en/)下载最新版或者官网推荐版本,我下载的是8.11.1
  • 2.将下载的文件安装到之前安装node.js的地方
  通过where node命令查看node路径
  C:\Users\lenovo>where node
  D:\downloads\node.js\node.exe
  • 3.双击刚刚下载的文件node-v8.12.0-x64.msi
  点击next 具体安装方法和之前第一次安装一样,但是注意在选择路径的时候要选成上面查到的node路径中。
  • 4.安装完成。通过npm -vnode -v查看当前版本号

标签: none

相关文章推荐

添加新评论,含*的栏目为必填