Home  >  Q&A  >  body text

javascript - 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:\Users\wf\AppData\Roaming\npm\node_modules\npm\lib\run-script.js:147:19)
4 verbose stack     at C:\Users\wf\AppData\Roaming\npm\node_modules\npm\lib\run-script.js:57:5
4 verbose stack     at C:\Users\wf\AppData\Roaming\npm\node_modules\npm\node_modules\read-package-json\read-json.js:345:5
4 verbose stack     at checkBinReferences_ (C:\Users\wf\AppData\Roaming\npm\node_modules\npm\node_modules\read-package-json\read-json.js:309:45)
4 verbose stack     at final (C:\Users\wf\AppData\Roaming\npm\node_modules\npm\node_modules\read-package-json\read-json.js:343:3)
4 verbose stack     at then (C:\Users\wf\AppData\Roaming\npm\node_modules\npm\node_modules\read-package-json\read-json.js:113:5)
4 verbose stack     at ReadFileContext.<anonymous> (C:\Users\wf\AppData\Roaming\npm\node_modules\npm\node_modules\read-package-json\read-json.js:284:20)
4 verbose stack     at ReadFileContext.callback (C:\Users\wf\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:76:16)
4 verbose stack     at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:303:13)
5 verbose cwd D:\jiajian_gitlab\tob-boston\bsc-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:\Users\wf\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin;D:\jiajian_gitlab\tob-boston\bsc-obor\node_modules\.bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Lenovo\FusionEngine;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\iFLYTEK\VoiceAssistant\SpeechPlusRuntime;C:\Program Files (x86)\Lenovo\Voice SDK;C:\Program Files (x86)\Lenovo\Lenovo Home\;C:\Program Files (x86)\QuickTime\QTSystem\;D:\reactSpace\nodeJs\;C:\Users\wf\AppData\Roaming\npm;D:\Program Files (x86)\Microsoft VS Code\bin
10 verbose lifecycle hehehehe@1.0.0~start: CWD: D:\jiajian_gitlab\tob-boston\bsc-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:\Users\wf\AppData\Roaming\npm\node_modules\npm\lib\utils\lifecycle.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:\Users\wf\AppData\Roaming\npm\node_modules\npm\lib\utils\spawn.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\tob-boston\bsc-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 isn't 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有问题?真心要崩溃了。

怪我咯怪我咯2771 days ago556

reply all(2)I'll reply

  • 黄舟

    黄舟2017-04-11 13:25:05

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

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-11 13:25:05

    原因是:
    根据@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

    reply
    0
  • Cancelreply