当前位置: 首页 > 知识库问答 >
问题:

在运行npm版本时命中npm错误

鱼安然
2023-03-14

我需要用于Angular 8 CLI的node10版本,并且在使用node10时。16.2,我得到如下所示的错误,并在运行npm build

npm-v10.16.2 -v
/auto/sw/packages/node/v10.16.2/lib/node_modules/npm/bin/npm-cli.js:84
let notifier = require('update-notifier')({pkg})
      ^^^

SyntaxError:在导出时,在严格模式之外尚不支持块作用域声明(let、const、function、class)。在模块上运行InthisContext(vm.js:53:16)
_在对象上编译(module.js:387:25)
。模块_扩展。。js(module.js:422:10)
在模块中。在函数处加载(module.js:357:32)
。模块_在函数处加载(module.js:314:12)
。单元runMain(module.js:447:10)
在启动时(node.js:148:18)
在节点上。js:405:3

如何解决这个问题?

共有1个答案

马坚
2023-03-14

您需要更新节点包以解决此问题。

如果你在ubuntu上,试试运行

sudo npm install -g n
sudo n stable

这将安装最新的节点包。

 类似资料:
  • 问题内容: 通常,我可以使用 npm 安装库,但是今天在安装yeoman时遇到了此错误。请帮助找出根本原因。 我查看了文件夹: C:\ Program Files \ nodejs \ node_modules \ npm \ bin \ 但看不到 node_modules 文件夹作为描述的错误。 我也尝试找到 npm-cli.js 并查看它实际上在 问题答案: 事实证明,问题出在系统变量中节点的

  • 0信息如果它以ok结尾就可以工作1详细cli['C:\程序文件\nodejs\node.exe',1详细cli'C:\users\bhargavii nadendla\appdata\roaming\npm\node_module\npm\bin\npm-cli.js',1详细cli'run',1详细cli'build']2使用npm@6.0.1 3使用node@v8.11.2 4详细run-sc

  • =d:\users\pjha\appdata\roaming\npm\node_modules\tty.js\node_modules\ws (node-gyp rebuild 2>builderror.log)(退出0)d:\users\pjha\appdata\roaming\npm\node_modules\tty.js\node_modules\ws>如果未定义npm_config_nod

  • =D:\Users\pjha\AppData\Roaming\npm\node\u modules\tty。js\node\u模块\ws (节点gyp重建2

  • 我对gradle和npm都是新手,我正在尝试启动并运行一个Grails3-AngularJS2示例应用程序。 这是应用程序https://github.com/agileorbit/grails3-angular2-starter 当我尝试并运行该应用程序时,我得到以下异常,似乎发生在这里

  • c: 我在cli中尝试了以下命令 c: 然后执行命令 c: 它给出了以下结果 当我运行命令cordova create hello com时。实例你好,HelloWorld 上面说 “cordova”不被识别为内部或外部命令、可操作程序或批处理文件。 我不明白问题是什么,为什么它不允许我创建项目,有时它创建项目,但不允许添加平台。 环境变量路径值为 %SystemRoot%\system32;%S