Bootstrap4-NPM启动错误

时间:2018-01-08 11:47:18

标签: npm bootstrap-4 npm-scripts

我正在学习使用npm脚本自动执行Web开发任务。

以下是我的 ngOnInit() { this.form = this.fb.group({ person: this.fb.group({ salutation: [{value: '', disabled: true}], firstName: ['', Validators.required], lastName: ['', Validators.required], email: ['', [Validators.required]] }) }); this.form.get('person').get('salutation').enable(); }

package.json

但是,当我在命令提示符下运行{ "name": "confusion", "version": "1.0.0", "description": "This is a website for Ristorante Con Fusion", "main": "index.html", "scripts": { "start": "npm run watch:all", "test": "echo \"Error: no test specified\" && exit 1", "lite": "lite-server", "scss": "node-sass -o css/ css/", "watch:scss": "onchange 'css/*.scss' --npm run scss", "watch:all": "parallelshell 'npm run watch:scss' 'npm run lite'" }, "author": "", "license": "ISC", "devDependencies": { "lite-server": "^2.2.2", "node-sass": "^4.7.2", "onchange": "^3.3.0", "parallelshell": "^3.0.2" }, "dependencies": { "bootstrap": "^4.0.0-alpha.6", "font-awesome": "^4.7.0" } } 时遇到以下错误:

错误讯息:

  

npm start

     

D:\encypher technologies\Bootstrap4-starter\Bootstrap4\conFusion>npm start

     

confusion@1.0.0 start D:\encypher technologies\Bootstrap4-starter\Bootstrap4\conFusion

     

npm run watch:all

     

confusion@1.0.0 watch:all D:\encypher technologies\Bootstrap4-starter\Bootstrap4\conFusion

     

parallelshell 'npm run watch:scss' 'npm run lite'

     

'npm' is not recognized as an internal or external command, operable program or batch file.

     

'run' is not recognized as an internal or external command, operable program or batch file.

     

The filename, directory name, or volume label syntax is incorrect.

     

'npm' is not recognized as an internal or external command, operable program or batch file.

     

'run' is not recognized as an internal or external command, operable program or batch file.

     

'lite'' is not recognized as an internal or external command, operable program or batch file.

     

npm ERR! code ELIFECYCLE

     

npm ERR! errno 1

     

npm ERR! confusion@1.0.0 watch:all: 'parallelshell 'npm run watch:scss' 'npm run lite'

     

npm ERR! Exit status 1

     

npm ERR!

     

npm ERR! Failed at the confusion@1.0.0 watch:all script.

     

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

     

npm ERR! A complete log of this run can be found in:

     

npm ERR! C:\Users\NIKHIL\AppData\Roaming\npm-cache\_log\2018-01-08T11_13_45_703Z-debug.log

     

npm ERR! Windows_NT 6.3.9600

     

npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\NIKHIL\\node_modules\\npm\\bin\\npm-cli.js" "start"

     

npm ERR! node v8.9.3

     

npm ERR! npm v2.15.12

     

npm ERR! code ELIFECYCLE

     

npm ERR! confusion@1.0.0 start: 'npm run watch:all'

     

npm ERR! Exit status 1

     

npm ERR!

     

npm ERR! Failed at the confusion@1.0.0 start script 'npm run watch:all'.

     

npm ERR! This is most likely a problem with the confusion package,

     

npm ERR! not with npm itself.

     

npm ERR! Tell the author that this fails on your system:

     

npm ERR! npm run watch:all

     

npm ERR! You can get information on how to open an issue for this project with:

     

npm ERR! npm bugs confusion

     

npm ERR! Or if that isn't available, you can get their info via:

     

npm ERR!

     

npm ERR! npm owner ls confusion

     

npm ERR! There is likely additional logging output above.

1 个答案:

答案 0 :(得分:0)

我猜你使用的是Windows。 Windows命令行不喜欢package.json中的单引号。请改用\"

"watch:scss": "onchange \"css/*.scss\" -- npm run scss",
"watch:all": "parallelshell \"npm run watch:scss\" \"npm run lite\""

您还错过了--npm之间的空格。