NodeJS在更改版本后停止工作



我正在开发Node版本9.1.0,但客户端要求我使用NVM,以便可以随意切换版本。我试过了,但它不起作用。所以我从我的Windows机器上卸载了NodeJS,并重新安装了NodeJS版本8.9.4

npm 安装后,当我尝试执行代码时,我收到此错误:

SyntaxError: Unexpected number
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:607:28)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:inetpubwwwrootNodeJS_APIsapinode_moduleslodashisFunction.js:1:80)

导致错误的行位于 vm .js:

function createScript(code, options) {
  return new Script(code, options);//This is the line
}

我不明白出了什么问题。有人可以解释一下我做错了什么吗?

从您的错误堆栈跟踪来看,错误似乎与您的loadash库有关,您能否尝试使用以下命令卸载它,

npm uninstall lodash

然后重新安装兼容的 lodash 版本,如下所示,

npm install lodash@4.17.5

完成后,请尝试再次运行脚本。

希望这有帮助!

你可能会

从这里得到一些提示,尽管我不确定: https://github.com/rollup/rollup/issues/2054

相关内容

最新更新