John Doe
John Doe

Reputation: 423

How can i run concurrently node.js and Vue?

i am trying to run the concurrently library and i get some trouble with commands. i am using this one: https://www.npmjs.com/package/concurrently

i am tried at my server to change the package.json:

 "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start":"node index.js",
    "server": "nodemon index.js",
    "client": "cd client && npm run serve",
    "dev": "concurrently \"nodemon index.js\" \"npm run serve\""
  },

and i have 2 seperated directories : Server and client

enter image description here

when i try "npm run dev" i get:

[0] [nodemon] 2.0.3
[0] [nodemon] to restart at any time, enter `rs`
[0] [nodemon] watching path(s): *.*
[0] [nodemon] watching extensions: js,mjs,json
[0] [nodemon] starting `node index.js`
[1] npm ERR! missing script: serve
[1] npm ERR!
[1] npm ERR! Did you mean this?
[1] npm ERR!     server
[1] 
[1] npm ERR! A complete log of this run can be found in:
[1] npm ERR!     C:\Users\David\AppData\Roaming\npm-cache\_logs\2020-06-14T14_51_57_124Z-debug.log
[1] npm run serve exited with code 1
[0] Sever started on port 3000

Upvotes: 1

Views: 2981

Answers (1)

user12948615
user12948615

Reputation:

Serve is probably defined in the client directory so you need to cd there first.

"dev": "concurrently \"nodemon index.js\" \"cd client && npm run serve\""

Upvotes: 2

Related Questions