webpack-dev-server出现“npm start”错误

时间:2017-01-10 19:04:38

标签: node.js reactjs npm webpack-dev-server

我知道这是一个形成问题的可怕方式,但我已经在这方面工作了几个小时并没有取得任何进展。昨晚一切都运行得很好,今天早上我从App Store获得了更新,让我重新启动,现在我的npm服务器(我正在努力学习React.js)无法正常工作。这是我的错误日志:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using npm@4.0.5
3 info using node@v4.6.1
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle react-essential@1.0.0~prestart: react-essential@1.0.0
6 silly lifecycle react-essential@1.0.0~prestart: no script for prestart, continuing
7 info lifecycle react-essential@1.0.0~start: react-essential@1.0.0
8 verbose lifecycle react-essential@1.0.0~start: unsafe-perm in lifecycle true
9 verbose lifecycle react-essential@1.0.0~start: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/FrankHarvey/Dropbox/react-practice/node_modules/.bin:/Users/FrankHarvey/anaconda2/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
10 verbose lifecycle react-essential@1.0.0~start: CWD: /Users/FrankHarvey/Dropbox/react-practice
11 silly lifecycle react-essential@1.0.0~start: Args: [ '-c', 'webpack-dev-server' ]
12 silly lifecycle react-essential@1.0.0~start: Returned: code: 1  signal: null
13 info lifecycle react-essential@1.0.0~start: Failed to exec start script
14 verbose stack Error: react-essential@1.0.0 start: `webpack-dev-server`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:279: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> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40: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:829:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
15 verbose pkgid react-essential@1.0.0
16 verbose cwd /Users/FrankHarvey/Dropbox/react-practice
17 error Darwin 16.3.0
18 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
19 error node v4.6.1
20 error npm  v4.0.5
21 error code ELIFECYCLE
22 error react-essential@1.0.0 start: `webpack-dev-server`
22 error Exit status 1
23 error Failed at the react-essential@1.0.0 start script 'webpack-dev-server'.
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 react-essential package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     webpack-dev-server
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs react-essential
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls react-essential
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

我试过了:

  • 切换端口
  • 还原git提交
  • 重新安装使用sudo
  • 运行的节点

没有人工作过。

4 个答案:

答案 0 :(得分:3)

node_modules目录中删除npm install webpack-dev-server并运行npm install

感谢评论,我能够解决。我尝试使用npm install webpack-dev-server重新安装。这没用。然后我尝试使用xyz/abc/node_modules/xyz/node_modules/abc/.bin/file并收到错误。它一直说webpack-dev-server之类的东西存在。移动并再试一次。我尝试了几次,最后从我的node_modules目录中删除了整个-bnot ([uint32]163) 目录并重新安装。这一切现在都有效。

顺便说一句,我使用Lynda.com的“React.js Essential Training”时使用了这个。仅包含可能存在此问题的其他人的此信息。

答案 1 :(得分:1)

不仅从webpack-dev-server目录中删除node_modules,而且从webpack-dev-middleware中删除。然后运行npm install webpack-dev-middlewarenpm install webpack-dev-server

答案 2 :(得分:0)

您可以在This is my jquery code $(document).ready(function(){ $('.reorder').on('click',function(){ $("ul.reorder-photos-list").sortable({ tolerance: 'pointer' }); $('.reorder').html('save reordering'); $('.reorder').attr("id","saveReorder"); $('#reorderHelper').slideDown('slow'); $('.img-w').attr("data-src",""); $('.img-w').css("cursor","move"); $("#saveReorder").click(function( e ){ if( !$("#saveReorder i").length ){ $(this).html('').prepend('saving...'); $("ul.reorder-photos-list").sortable('destroy'); $("#reorderHelper").html( "Reordering Photos - This could take a moment. Please don't navigate away from this page." ); var h = []; $("ul.reorder-photos-list li").each(function() { h.push($(this).attr('id') ) }); $.ajax({ type: "POST", url: "{{route("settings.updatephotos")}}", data: {ids: " " + h + ""}, success: function(){ window.location.reload(); } }); return false; } e.preventDefault(); }); }); }) 配置中将此选项设置为false:

webpack-dev-server =&gt; quiet: true

答案 3 :(得分:0)

根据需要设置webpack webpack cli webpack-dev-server,然后从项目中删除package-lock.json文件和节点模块文件夹,并在cmd中打开项目目录并运行npm install