并发运行前端和后端时出现错误



当我运行npm run dev时,我得到这个错误:

[1] npm ERR! code ENOENT
[1] npm ERR! syscall open
[1] npm ERR! path C:UsersreagaDesktopProjectsweather-app-v3apiclient/package.json   
[1] npm ERR! errno -4058
[1] npm ERR! enoent ENOENT: no such file or directory, open 'C:UsersreagaDesktopProjectsweather-app-v3apiclientpackage.json'
npm ERR! enoent This is related to npm not being able to find a file.
[1] npm ERR! enoent
[1]
[1] npm ERR! A complete log of this run can be found in:
[1] npm ERR!     C:UsersreagaAppDataLocalnpm-cache_logs2021-02-24T21_11_36_564Z-debug.log
[1] npm ERR! code 4294963238
[1] npm ERR! path C:UsersreagaDesktopProjectsweather-app-v3api
[1] npm ERR! command failed
[1] npm ERR! command C:WINDOWSsystem32cmd.exe /d /s /c npm run serve --prefix client    
[1] 
[1] npm ERR! A complete log of this run can be found in:
[1] npm ERR!     C:UsersreagaAppDataLocalnpm-cache_logs2021-02-24T21_11_37_020Z-debug.log

我有一个客户端文件夹,它包含Vue应用程序,与我的api文件夹在同一个目录下,它保存后端。

当我在正确的目录下分别运行启动脚本时,每个脚本都可以完美地独立工作。以下是我的脚本:

"scripts": {
"start": "node server",
"server": "nodemon server",
"client": "npm run serve --prefix client",
"dev": "concurrently "npm run server" "npm run client""
}

我知道C:UsersreagaDesktopProjectsweather-app-v3apiclient/package.json不存在,但我不知道为什么它会在那里。

原来是脚本!我必须从

更改客户端脚本
"client": "npm run serve --prefix client"

"client": "cd ../client && npm run serve"

相关内容

  • 没有找到相关文章

最新更新