【问题标题】:laravel react command run dev not workinglaravel react 命令运行开发不起作用
【发布时间】:2019-02-22 17:38:20
【问题描述】:
    C:\wamp64\www\want>npm run dev

> @ dev C:\wamp64\www\want
> npm run development


> @ development C:\wamp64\www\want
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

The system cannot find the path specified.
events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: spawn node_modules\webpack\bin\webpack.js ENOENT
    at notFoundError (C:\Users\coolm\AppData\Roaming\npm\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:6:26)
    at verifyENOENT (C:\Users\coolm\AppData\Roaming\npm\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:40:16)
    at ChildProcess.cp.emit (C:\Users\coolm\AppData\Roaming\npm\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:27:25)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
Emitted 'error' event at:
    at ChildProcess.cp.emit (C:\Users\coolm\AppData\Roaming\npm\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:30:37)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\coolm\AppData\Roaming\npm-cache\_logs\2018-09-18T16_07_49_646Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\coolm\AppData\Roaming\npm-cache\_logs\2018-09-18T16_07_49_686Z-debug.log

C:\wamp64\www\want>

我正在尝试将我的 Laravel 应用程序与 React 连接起来。我按照运行命令“php artisan preset react”的步骤操作,但是在我被指示运行 npm install & run dev 之后。我不断收到以下错误。有没有人有类似的问题?

【问题讨论】:

  • 自行运行npm install,看看是否有错误。
  • 是的,我做到了。没有运气

标签: reactjs laravel


【解决方案1】:

尝试完全重置:

rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install

【讨论】:

  • 我用 PowerShell 代替了 CMD,效果很好!
猜你喜欢
  • 2019-01-23
  • 2012-08-16
  • 1970-01-01
  • 1970-01-01
  • 2019-08-18
  • 2013-09-25
  • 2015-09-24
  • 2012-10-07
  • 1970-01-01
相关资源
最近更新 更多