欢迎光临
我们一直在努力

Laravel Mix的又一个坑:系统找不到指定的路径。

新安装的Laravel,按照官方教程试图安装Mix,使用默认的package.json在项目根目录运行以下命令(package.json是node的依赖文件,就像composer.json是composer的依赖文件是一个道理。

npm install

按照成功,然后运行

// Run all Mix tasks...
npm run dev

// Run all Mix tasks and minify output...
npm run production

报错
>系统找不到指定的路径。

E:\laragon\www\100>cnpm run dev

> @ dev E:\laragon\www\100
> npm run development


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

系统找不到指定的路径。
events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: spawn node_modules\webpack\bin\webpack.js ENOENT
    at notFoundError (E:\laragon\www\100\node_modules\_cross-spawn@5.1.0@cross-spawn\lib\enoent.js:11:11)
    at verifyENOENT (E:\laragon\www\100\node_modules\_cross-spawn@5.1.0@cross-spawn\lib\enoent.js:46:16)
    at ChildProcess.cp.emit (E:\laragon\www\100\node_modules\_cross-spawn@5.1.0@cross-spawn\lib\enoent.js:33:19)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:198: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 ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\DVY\AppData\Roaming\npm-cache\_logs\2017-12-06T20_01_45_975Z-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 ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\DVY\AppData\Roaming\npm-cache\_logs\2017-12-06T20_01_46_267Z-debug.log

E:\laragon\www\100>

最后到指定目录一看,竟然没有要的那个webpack.js,Webpack竟然是空的,任凭我怎么运行npm install,虽然都安装了,但是还是不行,最后没重新安装webpack

npm install webpack --save

OK,搞定,看来提示的没错,就是系统找不到文件,因为文件不存在,网上查了半天,多数是解释路径不对。

如果真还不能解决,删除node_modules目录,重新npm install

赞(0)
版权归原作者所有,如有侵权请告知。达维营-前端网 » Laravel Mix的又一个坑:系统找不到指定的路径。

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址