node.js - 在 Windows WSL2.0 上获取 SyntaxError: Unexpected token ...
问题描述
$ npm run dev
> moleculer-examples-conduit@3.0.0 dev /mnt/c/Users/pete/WebstormProjects/moleculer-examples/conduit
> moleculer-runner --repl services
/mnt/c/Users/pete/WebstormProjects/moleculer-examples/conduit/node_modules/moleculer/src/registry/registry.js:235
action.handler = this.broker.middlewares.wrapHandler("remoteAction", this.broker.transit.request.bind(this.b
roker.transit), { ...action, service });
^^^
SyntaxError: Unexpected token ...
at createScript (vm.js:53:10)
at Object.runInThisContext (vm.js:95:10)
at Module._compile (module.js:543:28)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/mnt/c/Users/pete/WebstormProjects/moleculer-examples/conduit/node_modules/moleculer/src/registry/index.js:9:18)
npm ERR! Linux 5.4.72-microsoft-standard-WSL2
npm ERR! argv "/home/pete/.nvm/versions/node/v7.10.1/bin/node" "/home/saul/.nvm/versions/node/v7.10.1/bin/npm" "run" "dev"
npm ERR! node v7.10.1
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! moleculer-examples-conduit@3.0.0 dev: `moleculer-runner --repl services`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the moleculer-examples-conduit@3.0.0 dev script 'moleculer-runner --repl services'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the moleculer-examples-conduit package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! moleculer-runner --repl services
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs moleculer-examples-conduit
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls moleculer-examples-conduit
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/saul/.npm/_logs/2021-09-28T20_56_23_700Z-debug.log
有什么想法我在这里想念的吗?我也在 WSL 的其他项目中得到了这个。
解决方案
我听从了 Lawrence 的建议,更新了 Node
$ nvm use 14
现在它可以工作了。
推荐阅读
- visual-studio - 无法从 Visual Studio 中的 TFS 项目中修改或删除标签
- python - 将非结构化 pandas 数据帧修改为新的结构化数据帧
- sql - 创建一个组合主键,其中一列接受 NULL
- mysql - Sequelize cast in MAX 导致 TypeError: smth.col.startsWith
- python - Selenium 在同一框架内找不到第二个元素
- r - 将数据写入相同xlsx的不同工作表
- r - 如何使用 ggplot 的 `geom_tile()` 更改 NA 正方形颜色
- java - 使用 XmlIo 在 apache 梁中读取 xml 文件
- java - 如何从HashMap中提取数据
在改造 2 中? - r - 从另一个数据框中的 a.character 列创建一个数据框,其中包含 R 中的元素列表