【发布时间】:2018-10-27 22:48:44
【问题描述】:
我回到了很久没用过的 Win10 电脑。首先,我尝试用
更新npm> npm i npm -g
我收到了这个:
added 290 packages, removed 250 packages and updated 37 packages in 38.815s
╭─────────────────────────────────────╮
│ │
│ Update available 5.0.0 → 6.4.1 │
│ Run npm i -g npm to update │
│ │
╰─────────────────────────────────────╯
然后,我尝试运行npm i -g npm 并得到:
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:974:3
现在当我尝试做任何事情时,我得到了同样的错误。如果您想知道我正在尝试从 npm 5.0.0 更新到 6.4.1。
我尝试过的事情
我用谷歌搜索了这个错误,发现如下:
-
- 在these instructions 之后,我首先尝试使用
npm cache clean -f清除npm 的缓存,但得到了相同的SyntaxError。 - 同样的说明还说要用 nvm 做一些我没有的东西,所以我尝试用
npm i nvm -g安装它,但同样的错误。
- 在these instructions 之后,我首先尝试使用
-
use strict,尽管我知道这是针对使用节点的程序。我想确保在发布问题之前我已经尝试了所有方法。
'"use strict"' is not recognized as an internal or external command, operable program or batch file.
Fresh npm install of webpack.js is throwing Block-scope error 但这似乎不适用于我,因为我没有使用 Visual Studio,而且我没有使用 babel 或 webpack 或 es6 做任何事情。我只是想更新 npm。
【问题讨论】:
标签: npm