laravel-mix运行npm run dev throw"找不到此依赖关系"

时间:2017-04-10 12:49:42

标签: webpack laravel-5.4 laravel-mix

我已按照以下方式设置webpack.mix.js

const { mix } = require('laravel-mix');
 mix.js('resources/assets/js/app.js', 'public/js')
    .js('resources/assets/js/pace.js', 'public/js/load.js')
    .sass('resources/assets/sass/app.scss', 'public/css');

我检查pace.js是否在resources/assets/js文件夹中,并且确实如此。 然后运行npm run dev,我收到此错误:

ERROR  Failed to compile with 1 errors                                                                                                                          14:37:37

This dependency was not found:

* pace in ./resources/assets/js/pace.js

To install it, you can run: npm install --save pace
            Asset      Size  Chunks                    Chunk Names
       /js/app.js   1.26 MB       0  [emitted]  [big]  /js/app
      /js/load.js   30.8 kB       1  [emitted]         /js/load
mix-manifest.json  64 bytes          [emitted]         

npm ERR! Darwin 16.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dev"
npm ERR! node v7.6.0
npm ERR! npm  v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! @ dev: `node node_modules/cross-env/dist/bin/cross-env.js 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 2
npm ERR! 
npm ERR! Failed at the @ dev script 'node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs 
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls 
npm ERR! There is likely additional logging output above.

编辑1

我刚刚发现实际上npm run dev正在抛出错误但也在编译。因此,如果我转到public/js/我可以看到load.js,内部的一切似乎都是正确的。 这让我更加困惑。

npm版本为4.1.2,节点版本为7.6.0

0 个答案:

没有答案