jsbrcad
jsbrcad

Reputation: 43

Can anyone help me with npm --prefix?

I'm stuck with npm --prefix. I'm trying to prefix my frontend folder so I can run both the backend and frontend at the same time.

I keep getting an error with the wrong pathway: \backend\frontend/package.json.

Can anyone help me with that?

{
      "name": "backend",
      "version": "1.0.0",
      "description": "User Authentication APP - MERN stack",
      "main": "server.js",
      "scripts": {
        "start": "node backend/server.js",
        "server": "nodemon backend/server.js",
        "client": "npm start --prefix frontend ",
        "dev": "concurrently \"npm run server\" \"npm run client\""
      }
    }

Upvotes: 2

Views: 12488

Answers (1)

Faraz Ahmad
Faraz Ahmad

Reputation: 21

You can test this package.json

"scripts": {
  "server": "npm run watch --prefix server",
  "client": "npm start --prefix client",
  "watch": "npm run server & npm run client"
}

Then run npm run watch

Upvotes: 0

Related Questions