0

package.json

      "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1",
        "dev": "cd profile-app-server && nodemon server.js",
        "client": "cd client/profile-front-end && npm start",
        "start": "concurrently \"npm run dev\" \"npm run client\" "
      },

npm ERR! enoent ENOENT: no such file or directory, open '/Users/SebastianRusso/Desktop/profile-app/package.json'

when i run them separately, they both work fine. the server is running on 3001, so not to interfere with react.

the app is called, 'profile-app' which holds a 'client folder' which holds, 'profile-front-end' the app, 'profile-app' also holds 'profile-app-server'

i'm wondering if i have the paths mixed up somehow. I've played around and tried different things, but kind of at a road block now

Seb
  • 133
  • 1
  • 12
  • as per error message, you don't have the package.json in the folder. – Someone Special Nov 27 '20 at 22:07
  • Does this answer your question? [Is it possible to use npm to run scripts in multiple subfolders?](https://stackoverflow.com/questions/32783885/is-it-possible-to-use-npm-to-run-scripts-in-multiple-subfolders) – falinsky Nov 27 '20 at 22:10

2 Answers2

1

so basically to make both run, only the client can be in another folder.

i put the server in a separate folder as well, but that was incorrect, and that's why npm start could not find the folder.

in the end i removed the server folder, and changed the code to this and it works (runs both client side and server side)

      "dev": "nodemon server.js",
      "client": "cd client/avybe-challenge-profile && npm start",
      "start": "concurrently \"npm run dev\" \"npm run client\" "
Seb
  • 133
  • 1
  • 12
0

My guess is you need to figure out the path to get from your server package.json to your client package.json file. The client path for your script may need to be slightly altered.

"scripts": {
        "test": "echo \"Error: no test specified\" && exit 1",
        "dev": "cd profile-app-server && nodemon server.js",
        "client": "cd ../client/profile-front-end && npm start",
        "start": "concurrently \"npm run dev\" \"npm run client\" "
      },

Not sure if that's the correct path, but it is probably somewhere along those lines.

Noah Kanyo
  • 500
  • 1
  • 3
  • 8
  • should i have a separate package json outside of the client and server folders? – Seb Nov 27 '20 at 22:26
  • That won't be necessary. If you configure the right path to your client it should work. Perhaps copy and paste the command listed into your CMD from your backend folder to see if you land on the client folder with the package.json file. If not change it slightly. – Noah Kanyo Nov 27 '20 at 22:36