我在我的节点项目中使用并发npm 包(5.1.0)来并行运行两个 npm 脚本。但是当我npm start
在 cmd 提示符下运行以启动我的脚本时,同时尝试在我认为是我的主目录(我的机器上的 system32 文件夹)中运行命令。
我的 package.json 中有以下内容:
{
"scripts": {
"build:watch": "tsc -p src/ -w",
"serve": "lite-server -c=bs-config.json",
"start": "concurrently \"npm run build:watch\" \"npm run serve\""
}
}
这是我得到的输出:
> concurrently "npm run build:watch" "npm run serve"
[0] npm ERR! path C:\Windows\System32\package.json
[0] npm ERR! code ENOENT
[0] npm ERR! errno -4058
[0] npm ERR! syscall open
[0] npm ERR! enoent ENOENT: no such file or directory, open 'C:\Windows\System32\package.json'
[0] npm ERR! enoent This is related to npm not being able to find a file.
[0] npm ERR! enoent
[0]
[0] npm ERR! A complete log of this run can be found in:
[0] npm ERR! C:\Users\myuser\AppData\Roaming\npm-cache\_logs\2020-04-08T21_07_59_146Z-debug.log
[1] npm ERR! path C:\Windows\System32\package.json
[1] npm ERR! code ENOENT
[1] npm ERR! errno -4058
[1] npm ERR! syscall open
[1] npm ERR! enoent ENOENT: no such file or directory, open 'C:\Windows\System32\package.json'
[1] npm ERR! enoent This is related to npm not being able to find a file.
[1] npm ERR! enoent
[0] npm run build:watch exited with code 4294963238
[1]
[1] npm ERR! A complete log of this run can be found in:
[1] npm ERR! C:\Users\myuser\AppData\Roaming\npm-cache\_logs\2020-04-08T21_07_59_182Z-debug.log
[1] npm run serve exited with code 4294963238
我尝试了不同版本的并发,并试图找到一种动态指定工作目录的方法,但失败了。任何帮助将不胜感激。