我正在尝试将 nodejs 升级到我机器中的最新版本。通过 npm 执行以下命令后,我遇到了以下错误。
npm install -g n
这给出了如下错误
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for n@2.1.12: wanted {"os":"!win32","arch":
"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! notsup Valid OS: !win32
npm ERR! notsup Valid Arch: any
npm ERR! notsup Actual OS: win32
npm ERR! notsup Actual Arch: x64
然后我发现了这个问题并执行了下面的命令。
npm install --global --production npm-windows-upgrade
npm-windows-upgrade --npm-version latest
我在节点命令提示符下遇到错误
C:\Users\myName\AppData\Roaming\npm\node_modules\npm-windows-upgrade\src\upgrader.j
s:26
async ensureInternet () {
^^^^^^^^^^^^^^
SyntaxError: Unexpected identifier
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Users\HP2\AppData\Roaming\npm\node_modules\npm-win
dows-upgrade\bin\npm-windows-upgrade.js:8:16)
有人可以帮忙吗?
当前版本 npm6.9.0
当前版本节点v6.10.3