Bootstrap4-NPM启动报错

Bootstrap4-NPM start error

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

下面是我的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\_log18-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.

npm ERR! Please include the following file with any support request: npm ERR! D:\encypher technologies\Bootstrap4-starter\Bootstrap4\conFusion\npm-debug.log

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

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

您还遗漏了 --npm 之间的 space。