react.js 从0.14.6版本升级到15.3.2版,报错,请问是什么原因

npm debug:

0 info it worked if it ends with ok
1 verbose cli [ D:\reactSpace\nodeJs\node.exe,
1 verbose cli C:\Users\wf\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js,
1 verbose cli run,
1 verbose cli start ]
2 info using npm@3.5.3
3 info using node@v4.2.4
4 verbose stack Error: missing script: start
4 verbose stack at run C:UserswfAppDataRoaming
pm
ode_modules
pmlib
un-script.js:147:19
4 verbose stack at C:UserswfAppDataRoaming
pm
ode_modules
pmlib
un-script.js:57:5
4 verbose stack at C:UserswfAppDataRoaming
pm
ode_modules
pm
ode_modules
ead-package-json
ead-json.js:345:5
4 verbose stack at checkBinReferences_ C:UserswfAppDataRoaming
pm
ode_modules
pm
ode_modules
ead-package-json
ead-json.js:309:45
4 verbose stack at final C:UserswfAppDataRoaming
pm
ode_modules
pm
ode_modules
ead-package-json
ead-json.js:343:3
4 verbose stack at then C:UserswfAppDataRoaming
pm
ode_modules
pm
ode_modules
ead-package-json
ead-json.js:113:5
4 verbose stack at ReadFileContext.<anonymous> C:UserswfAppDataRoaming
pm
ode_modules
pm
ode_modules
ead-package-json
ead-json.js:284:20
4 verbose stack at ReadFileContext.callback C:UserswfAppDataRoaming
pm
ode_modules
pm
ode_modulesgraceful-fsgraceful-fs.js:76:16
4 verbose stack at FSReqWrap.readFileAfterOpen [as oncomplete] fs.js:303:13
5 verbose cwd D:jiajian_gitlab	ob-bostonsc-obor
6 error Windows_NT 6.3.9600
7 error argv "D:\reactSpace\nodeJs\node.exe" "C:\Users\wf\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "run" "start"
8 error node v4.2.4
9 error npm v3.5.3
10 error missing script: start
11 error If you need help, you may report this error at:
11 error <https://github.com/npm/npm/issues>
12 verbose exit [ 1, true ]

编译时,报错:

请问是哪里的原因呢?

根据@yesmeck大神的判断,我在package.json的scripts中输入之前的配置:

"scripts": { "start": "webpack-dev-server --hot --progress --colors", "build": "webpack --progress --colors", "prd": "webpack -p", "watch": "webpack --watch" }

再次编译,报如下的错误,提示的大概意思是,会在npm-debug中增加提示信息:

在npm-debug中增加如下信息:

0 info it worked if it ends with ok
1 verbose cli [ D:\reactSpace\nodeJs\node.exe,
1 verbose cli C:\Users\wf\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js,
1 verbose cli run,
1 verbose cli start ]
2 info using npm@3.5.3
3 info using node@v4.2.4
4 verbose run-script [ prestart, start, poststart ]
5 info lifecycle hehehehe@1.0.0~prestart: hehehehe@1.0.0
6 silly lifecycle hehehehe@1.0.0~prestart: no script for prestart, continuing
7 info lifecycle hehehehe@1.0.0~start: hehehehe@1.0.0
8 verbose lifecycle hehehehe@1.0.0~start: unsafe-perm in lifecycle true
9 verbose lifecycle hehehehe@1.0.0~start: PATH: C:UserswfAppDataRoaming
pm
ode_modules
pmin
ode-gyp-bin;D:jiajian_gitlab	ob-bostonsc-obor
ode_modules.bin;C:ProgramDataOracleJavajavapath;C:Program Files x86LenovoFusionEngine;C:Program Files x86InteliCLS Client;C:Program FilesInteliCLS Client;C:Program Files x86NVIDIA CorporationPhysXCommon;C:windowssystem32;C:windows;C:windowsSystem32Wbem;C:windowsSystem32WindowsPowerShellv1.0;C:Program FilesIntelIntelR Management Engine ComponentsDAL;C:Program FilesIntelIntelR Management Engine ComponentsIPT;C:Program Files x86IntelIntelR Management Engine ComponentsDAL;C:Program Files x86IntelIntelR Management Engine ComponentsIPT;C:Program FilesIntelWiFiin;C:Program FilesCommon FilesIntelWirelessCommon;C:Program Files x86iFLYTEKVoiceAssistantSpeechPlusRuntime;C:Program Files x86LenovoVoice SDK;C:Program Files x86LenovoLenovo Home;C:Program Files x86QuickTimeQTSystem;D:
eactSpace
odeJs;C:UserswfAppDataRoaming
pm;D:Program Files x86Microsoft VS Codein
10 verbose lifecycle hehehehe@1.0.0~start: CWD: D:jiajian_gitlab	ob-bostonsc-obor
11 silly lifecycle hehehehe@1.0.0~start: Args: [ /d /s /c, webpack-dev-server --hot --progress --colors ]
12 silly lifecycle hehehehe@1.0.0~start: Returned: code: 1 signal: null
13 info lifecycle hehehehe@1.0.0~start: Failed to exec start script
14 verbose stack Error: hehehehe@1.0.0 start: `webpack-dev-server --hot --progress --colors`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> C:UserswfAppDataRoaming
pm
ode_modules
pmlibutilslifecycle.js:232:16
14 verbose stack at emitTwo events.js:87:13
14 verbose stack at EventEmitter.emit events.js:172:7
14 verbose stack at ChildProcess.<anonymous> C:UserswfAppDataRoaming
pm
ode_modules
pmlibutilsspawn.js:24:14
14 verbose stack at emitTwo events.js:87:13
14 verbose stack at ChildProcess.emit events.js:172:7
14 verbose stack at maybeClose internal/child_process.js:818:16
14 verbose stack at Process.ChildProcess._handle.onexit internal/child_process.js:211:5
15 verbose pkgid hehehehe@1.0.0
16 verbose cwd D:jiajian_gitlab	ob-bostonsc-obor
17 error Windows_NT 6.3.9600
18 error argv "D:\reactSpace\nodeJs\node.exe" "C:\Users\wf\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "run" "start"
19 error node v4.2.4
20 error npm v3.5.3
21 error code ELIFECYCLE
22 error hehehehe@1.0.0 start: `webpack-dev-server --hot --progress --colors`
22 error Exit status 1
23 error Failed at the hehehehe@1.0.0 start script webpack-dev-server --hot --progress --colors.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the hehehehe package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error webpack-dev-server --hot --progress --colors
23 error You can get information on how to open an issue for this project with:
23 error npm bugs hehehehe
23 error Or if that isnt available, you can get their info via:
23 error npm owner ls hehehehe
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ] 

是不是node.js有问题?真心要崩溃了。

看看你 package.json 的 scripts 里有没有 start

原因是:
根据@yesmeck大神的判断,我在package.json的scripts中输入之前的配置:

"scripts": { "start": "webpack-dev-server --hot --progress --colors", "build": "webpack --progress --colors", "prd": "webpack -p", "watch": "webpack --watch" }

重新卸载:

npm uninstall webpack
npm uninstall webpack-dev-middleware
npm uninstall webpack-dev-server

重新安装:

npm install webpack --save
npm install webpack-dev-middleware --save
npm install webpack-dev-server --save

就OK了,再次感谢@yesmeck

发表评论

电子邮件地址不会被公开。 必填项已用*标注