0

When I run npm run dev, I am getting this error:

[1] npm ERR! code ENOENT
[1] npm ERR! syscall open
[1] npm ERR! path C:\Users\reaga\Desktop\Projects\weather-app-v3\api\client/package.json   
[1] npm ERR! errno -4058
[1] npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\reaga\Desktop\Projects\weather-app-v3\api\client\package.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:\Users\reaga\AppData\Local\npm-cache\_logs\2021-02-24T21_11_36_564Z-debug.log
[1] npm ERR! code 4294963238
[1] npm ERR! path C:\Users\reaga\Desktop\Projects\weather-app-v3\api
[1] npm ERR! command failed
[1] npm ERR! command C:\WINDOWS\system32\cmd.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:\Users\reaga\AppData\Local\npm-cache\_logs\2021-02-24T21_11_37_020Z-debug.log

I have a client folder containing the Vue app in the same directory as my api folder, which holds the backend.

When I run the starting scripts separately while in the correct directory, each one works perfectly on its own. Here are my scripts:

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

I know that C:\Users\reaga\Desktop\Projects\weather-app-v3\api\client/package.json doesn't exist, but I don't know why it is looking there in the first place.

supernova
  • 127
  • 1
  • 1
  • 12
  • 1
    Check this out: https://stackoverflow.com/a/41772105/1971120 `--prefix ` tells npm to look for `package.json` in that folder – germanio Feb 24 '21 at 21:37

1 Answers1

1

Turns out it was the script! I had to change the client script from

"client": "npm run serve --prefix client"

to

"client": "cd ../client && npm run serve"
supernova
  • 127
  • 1
  • 1
  • 12