`node : not found` 尝试`npm 运行 dev`

`node : not found` when trying to `npm run dev`

我正尝试在我的 Windows 10 系统上 运行 Svelte example project。我正在使用 Node v14.17.0 和 npm v6.14.13。当我 运行 npm run dev 在项目级别目录时,我得到以下错误。

C:\...\my-svelte-project>npm run dev

> svelte-app@1.0.0 dev C:\...\my-svelte-project
> rollup -c -w

/mnt/c/.../my-svelte-project/node_modules/.bin/rollup: 12: /mnt/c/.../my-svelte-project/node_modules/.bin/rollup: node: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file bash
npm ERR! errno ENOENT
npm ERR! svelte-app@1.0.0 dev: `rollup -c -w`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the svelte-app@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\...\AppData\Roaming\npm-cache\_logs21-05-22T12_25_15_891Z-debug.log

我似乎无法找出错误,我已经尝试了一系列在线提供的建议。有人遇到过这个吗?我对 node : not found prompt 最困惑,即使节点已明确安装并位于 Path 变量上。

附加信息: 我尝试 运行 rollup -c -w,这是我得到的错误日志 -

21 error code ELIFECYCLE
22 error syscall spawn bash
23 error file bash
24 error path bash
25 error errno -4058
26 error svelte-app@1.0.0 start: `sirv public --no-clear`
26 error spawn bash ENOENT
27 error Failed at the svelte-app@1.0.0 start script.
27 error This is probably not a problem with npm. There is likely additional logging output above.
28 verbose exit [ -4058, true ]

如果您尝试重新安装节点模块 and/or 节点整体:

错误似乎是缺少 to/from bashsirv 命令的访问权限 - 我们可以从 ENOENT(Error NO Entry 的缩写)中推断出这一点。如果您查看 npm settings docs,我们可以了解如何配置 shell npm 尝试在其脚本中使用的 运行。我怀疑如果你 运行 npm config get script-shell 你会得到 bash - 在 windows 的情况下具体指的是 git bash。

在我的系统上有一个工作的 svelte 示例,我将它设置为 null(我没有手动设置,奇怪的是它不是文档中的选项之一)所以你可以尝试设置它使用 npm config set script-shell=null 或者如果这不能节省您的培根,请尝试 npm config set script-shell=cmd.exe.