我第一次尝试使用节点包,我尝试使用的是https://github.com/codingphasedotcom/Starter-Kit-2018 我已经在readme.md文件中完成了所有操作,但每次使用命令时都会收到错误" npm run watch",我已粘贴下面的调试日志。 如果重要的话,我会在Windows电脑上工作。 感谢。
0信息,如果它以ok结束它是否有效
1详细cli [' C:\ Program Files \ nodejs \ node.exe',
1详细cli' C:\ Program Files \ nodejs \ node_modules \ npm \ bin \ npm-cli.js',
1详细的cli' run',
1详细的cli' watch' ]
2信息使用npm@5.6.0
3 info使用node@v9.4.0
4详细的运行脚本[' prewatch',' watch',' postwatch' ]
5 info lifecycle RockyBoy@1.0.0 ~prewatch:RockyBoy@1.0.0
6 info lifecycle RockyBoy@1.0.0~watch:RockyBoy@1.0.0
7详细生命周期RockyBoy@1.0.0~watch:生命周期中的unsafe-perm为真
8详细生命周期RockyBoy@1.0.0~watch:路径:C:\ Program Files \ nodejs \ node_modules \ npm \ node_modules \ npm-lifecycle \ node-gyp-bin; C:\ Users \ JeArc \ OneDrive \ Projects \ todo- APP-HTML \ node_modules.bin; C:\ ProgramData \甲骨文\爪哇\ javapath; C:\窗口\ system32; C:\ WINDOWS; C:\ Windows \ System32下\ WBEM; C:\ Windows \ System32下\ WindowsPowerShell \ V1 .0 \; C:\ Program Files(x86)\ NVIDIA Corporation \ PhysX \ Common; C:\ Program Files(x86)\ GtkSharp \ 2.12 \ bin; C:\ WINDOWS \ system32; C:\ WINDOWS; C:\ WINDOWS \ System32 \ Wbem; C:\ WINDOWS \ System32 \ WindowsPowerShell \ v1.0 \; C:\ Program Files \ Git \ cmd; C:\ Program Files \ nodejs \; C:\ Users \ JeArc \ AppData \ Local \微软\ WindowsApps; C:\用户\ JeArc \应用程序数据\本地\原子\ BIN; C:\用户\ JeArc \应用程序数据\本地\ GitHubDesktop \ BIN; C:\用户\ JeArc \应用程序数据\漫游\ NPM
9详细生命周期RockyBoy@1.0.0~watch:CWD:C:\ Users \ JeArc \ OneDrive \ Projects \ todo-app-html
10愚蠢的生命周期RockyBoy@1.0.0~watch:Args:[' / d / s / c',' gulp' ]
11傻生命周期RockyBoy@1.0.0~watch:返回:代码:1信号:null
12 info lifecycle RockyBoy@1.0.0~watch:执行监视脚本失败
13详细堆栈错误:RockyBoy@1.0.0观察:gulp
13详细堆栈退出状态1
在EventEmitter上有13个详细堆栈。 (C:\ Program Files \ nodejs \ node_modules \ npm \ node_modules \ npm-lifecycle \ index.js:285:16)
EventEmitter.emit上的13个详细堆栈(events.js:160:13)
ChildProcess上的13个详细堆栈。 (C:\ Program Files \ nodejs \ node_modules \ npm \ node_modules \ npm-lifecycle \ lib \ spawn.js:55:14)
ChildProcess.emit上的13个详细堆栈(events.js:160:13)
在maybeClose上的13个详细堆栈(internal / child_process.js:943:16)
Process.ChildProcess._handle.onexit上的13个详细堆栈(internal / child_process.js:220:5)
14详细pkgid RockyBoy@1.0.0
15 verbose cwd C:\ Users \ JeArc \ OneDrive \ Projects \ todo-app-html
16详细的Windows_NT 10.0.15063
17 verbose argv" C:\ Program Files \ nodejs \ node.exe" " C:\ Program Files \ nodejs \ node_modules \ npm \ bin \ npm-cli.js" "运行" "钟表"
18详细节点v9.4.0
19详细npm v5.6.0
20错误代码ELIFECYCLE
21错误错误1
22错误RockyBoy@1.0.0观看:gulp
22错误退出状态1
23错误RockyBoy@1.0.0监视脚本失败。
23错误这可能不是npm的问题。上面可能有额外的日志记录输出。
24详细退出[1,true]
https://i.stack.imgur.com/d0pT4.png
这是我的package.json文件。 { "姓名":" RockyBoy", "版本":" 1.0.0", "描述":" Super Cool Framework", " main":" index.js", "作者":" joe santos garcia", "许可证":" MIT", "主页":" http://rocky.codingphase.com/", "依赖":{ " axios":" ^ 0.16.1", " babel-core":" ^ 6.24.1", " babel-loader":" ^ 6.4.1", " babel-preset-env":" ^ 1.4.0", " babel-preset-es2015":" ^ 6.24.1", " babel-preset-react":" ^ 6.24.1", " babel-preset-stage-0":" ^ 6.24.1", "浏览器同步":" ^ 2.18.8", " gulp":" ^ 3.9.1", " gulp-autoprefixer":" ^ 3.1.1", " gulp-babel":" ^ 6.1.2", " gulp-concat":" ^ 2.6.0", " gulp-eslint":" ^ 3.0.1", " gulp-imagemin":" ^ 3.0.3", " gulp-sass":" ^ 2.3.2", " gulp-shell":" ^ 0.6.3", " gulp-uglify":" ^ 2.0.0", " gulp-watch":" ^ 4.3.9", " html-webpack-plugin":" ^ 2.28.0", " node-sass":" ^ 4.5.2", "反应":" ^ 15.5.4", " react-dom":" ^ 15.5.4", " react-redux":" ^ 5.0.4", " react-router":" ^ 4.1.1", " redux":" ^ 3.6.0", " sass-loader":" ^ 6.0.3", "标准":" ^ 10.0.2", " webpack":" ^ 2.5.1", " webpack-stream":" ^ 3.2.0" } "脚本":{ "捆绑":" ./ node_modules / .bin / webpack", " production":" ./ node_modules / .bin / webpack -p", "观看":" gulp", " sass":" gulp styles", " js":" gulp webpack" }, " devDependencies":{ " babel-preset-stage-0":" ^ 6.24.1" } }
答案 0 :(得分:1)
在你的package.json
文件中,你可能在某个地方有这样的东西:
"scripts": {
"start": "node server/index.js",
"watch": "gulp 'something here'"
}
请将其更改为:
"scripts": {
"start": "node server/index.js",
"watch": "gulp \"something here\""
}
这基本上是因为windows只能理解双引号,而在你的脚本中,某些内容是用单引号写的。
注意:也可能由于某些其他原因而发生,如果您在此处提供package.json
文件,我将能够为您提供更好的帮助。