最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - nodejs npm start error with concurrently - Stack Overflow

programmeradmin1浏览0评论

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 o um ando 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 o um ando interno ou externo,
[0] [1] [1] programa operacional ou ficheiro batch.
[0] [1] [4] 'serve' n?o ? reconhecido o um ando 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 o um ando 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/mon": "^4.0.0",
        "@angular/piler": "^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/piler-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"
    }
}

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 o um ando 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 o um ando interno ou externo,
[0] [1] [1] programa operacional ou ficheiro batch.
[0] [1] [4] 'serve' n?o ? reconhecido o um ando 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 o um ando 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/mon": "^4.0.0",
        "@angular/piler": "^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/piler-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"
    }
}
Share Improve this question edited Jul 29, 2017 at 13:06 Rui Sebastião asked Jul 29, 2017 at 10:41 Rui SebastiãoRui Sebastião 8831 gold badge18 silver badges36 bronze badges 3
  • Use "npm start" . This will execute your start script. – mehta-rohan Commented Jul 29, 2017 at 11:20
  • npm start is just a shortcut for npm run start, which is the same thing – ralphtheninja Commented Jul 29, 2017 at 13:02
  • Have you installed concurrently? What does your package.json look like? – ralphtheninja Commented Jul 29, 2017 at 13:02
Add a ment  | 

2 Answers 2

Reset to default 4

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 bination. And it is certainly a feature of npm, because other mand I tried work perfectly without raw flag. I.e. the following will work fine:

concurrently "tsc" "node-sass --output-style pressed index.scss ./out/index.css"

You need to install concurrently.

The tool is written in Node.js, but you can use it to run any mands.

npm install -g concurrently

or if you are using it from npm scripts:

npm install concurrently --save

Usage

Remember to surround separate mands with quotes:

concurrently "mand1 arg" "mand2 arg"

Otherwise concurrently would try to run 4 separate mands: mand1, arg, mand2, arg.

In package.json, escape quotes:

"start": "concurrently \"mand1 arg\" \"mand2 arg\""

https://www.npmjs./package/concurrently

发布评论

评论列表(0)

  1. 暂无评论