【发布时间】:2022-01-24 06:54:44
【问题描述】:
我遇到了一个我不知道如何解决的问题。 我在 Windows 上使用 WebStorm。我已经安装了 Makefile Language 插件来自动启动命令
install:
npm ci
brain-games:
node bin/brain-games.js
publish:
npm publish --dry-run
lint:
npx eslint
但我不能这样做,它会返回错误
C:\ProgramData\chocolatey\bin\make.exe -f *way-to-the-project*/Makefile publish
process_begin: CreateProcess(NULL, npm publish --dry-run, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [*way-to-the-project*/Makefile:6: publish] Error 2
我尝试使用 Microsoft Store 中的 Powershell 和 Ubuntu 运行“make”命令,效果很好,但我无法理解该插件有什么问题以及如何正确使用它。
请给我任何建议:)
【问题讨论】:
-
这个错误表示找不到程序
npm。要么未安装,要么不在您的 PATH 上。 -
@MadScientist 我已经检查过了,在 PATH 中设置了
C:\Program Files\nodejs\和C:\Users\*my-username*\AppData\Roaming\npm。我还添加了这个C:\Program Files\nodejs\node_modules\npm\bin,但它没有帮助。我重新安装了 Node.js 并检查了 Node.js 和 npm 的“添加到 PATH”,但也没有用 -
如果在调用 make 之前从 shell 提示符运行
npm,它会起作用吗? “shell 提示符”并不一定是指您在此处显示的 cmd.exe 提示符。我的意思是外壳调用。如果您不确定那是什么,请将$(info shell is $(SHELL))添加到您的 makefile 中并查看它打印的内容。 -
@MadScientist 我输入了你建议的命令,它返回
shell is sh.exe,但它没有给我任何意义:D 我不明白如何预运行 sh.exe i> 在执行 make 命令之前。我尝试在 Makefile Language 插件中添加 Before launch 并放在那里 sh.exe 但它只是运行并且没有 make 命令被执行 -
@MadScientist 是的,当我在我的项目文件夹中时,
npm也从 sh.exe 运行 :)
标签: windows npm makefile webstorm