Reputation: 883
I have the following code in package.json:
"scripts": {
"start": "concurrently --kill-others \"npm run _server:run\" \"ng serve --aot --progress=false --proxy-config proxy.conf.json\"",
"lint:client": "ng lint",
"lint:server": "tslint './server/**/*.ts' -c ./server/tslint.json --fix",
"test:client": "ng test",
"e2e:client": "ng e2e",
"build": "ng build --prod --sm=false --aot --output-path=dist/client && npm run _server:build",
"_server:run": "tsc -p ./server && concurrently \"tsc -w -p ./server\" \"nodemon --debug dist/server/bin/www.js\" ",
"_server:build": "tsc -p ./server",
"postinstall": "npm run build"
},
if i run:
npm run _server:run
everything works fine, but if i run:
npm run start
i get the following error:
[0] [1] [0] 'np' n?o ? reconhecido como um comando interno ou externo,
[0] [1] [0] programa operacional ou ficheiro batch.
[0] [1] [2] A sintaxe do nome do ficheiro, do nome do direct?rio ou da etiqueta
do volume ? incorrecta.
[0] [1] [1] 'run' n?o ? reconhecido como um comando interno ou externo,
[0] [1] [1] programa operacional ou ficheiro batch.
[0] [1] [4] 'serve' n?o ? reconhecido como um comando interno ou externo,
[0] [1] [4] programa operacional ou ficheiro batch.
[0] [1] [1] run exited with code 1
[0] [1] --> Sending SIGTERM to other processes..
[0] [1] [2] _server:run" exited with code 1
[0] [1] [0] np exited with code 1
[0] [1] [3] 'n' n?o ? reconhecido como um comando interno ou externo,
[0] [1] [3] programa operacional ou ficheiro batch.
[0] [1] [4] serve exited with code 1
[0] [1] [3] n exited with code 1
my windows is in Portuguese so some parts are in Portuguese, but essentially it says np program not recognized .
i'm pretty new to nodejs,i think is something about 'concurrently' but i can't figure out what is the problem
EDIT
full package.json:
{
"name": "dynamicflowweb",
"version": "4.0.9",
"scripts": {
"start": "concurrently --kill-others \"npm run _server:run\" \"ng serve --aot --progress=false --proxy-config proxy.conf.json\"",
"lint:client": "ng lint",
"lint:server": "tslint './server/**/*.ts' -c ./server/tslint.json --fix",
"test:client": "ng test",
"e2e:client": "ng e2e",
"build": "ng build --prod --sm=false --aot --output-path=dist/client && npm run _server:build",
"_server:run": "tsc -p ./server && concurrently \"tsc -w -p ./server\" \"nodemon --debug dist/server/bin/www.js\" ",
"_server:build": "tsc -p ./server",
"postinstall": "npm run build"
},
"private": true,
"dependencies": {
"@agm/core": "^1.0.0-beta.0",
"@angular/animations": "^4.0.0",
"@angular/cli": "^1.2.4",
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
"angular-bootstrap-md": "*",
"angular2-jwt": "^0.2.3",
"chart.js": "2.5.0",
"classlist.js": "^1.1.20150312",
"core-js": "^2.4.1",
"easy-pie-chart": "^2.1.7",
"font-awesome": "^4.7.0",
"hammerjs": "^2.0.8",
"jsonwebtoken": "^7.4.1",
"rxjs": "^5.1.0",
"screenfull": "^3.2.0",
"web-animations-js": "^2.2.5",
"webpack": "^2.2.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular/cli": "1.0.0",
"@angular/compiler-cli": "^4.0.0",
"@types/jasmine": "2.5.38",
"@types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"concurrently": "^3.5.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^0.2.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"nodemon": "^1.11.0",
"protractor": "~5.1.0",
"ts-node": "~2.0.0",
"tslint": "~4.5.0",
"typescript": "~2.2.0"
}
}
Upvotes: 4
Views: 5750
Reputation: 810
You need to install concurrently.
The tool is written in Node.js, but you can use it to run any commands.
npm install -g concurrently
or if you are using it from npm scripts:
npm install concurrently --save
Usage
Remember to surround separate commands with quotes:
concurrently "command1 arg" "command2 arg"
Otherwise concurrently would try to run 4 separate commands: command1, arg, command2, arg.
In package.json, escape quotes:
"start": "concurrently \"command1 arg\" \"command2 arg\""
https://www.npmjs.com/package/concurrently
Upvotes: 0
Reputation: 96
The only thing that worked for me is to add --raw, so I use
concurrently --raw "npm:task1" "npm:task2"
I don't know why it works only in this combination. And it is certainly a feature of npm, because other command I tried work perfectly without raw flag. I.e. the following will work fine:
concurrently "tsc" "node-sass --output-style compressed index.scss ./out/index.css"
Upvotes: 4