Laravel 5.4 NPM运行dev的错误

问题描述:

FIXED:的解决办法是删除该文件夹node_modules并重新运行NPM INSTAL,并在此之后一切工作。Laravel 5.4 NPM运行dev的错误

我有一些问题Laravel并试图运行 “故宫运行dev的”,我得到这个错误:

   Asset  Size Chunks     Chunk Names 
     /js/app.js 1.18 MB  0 [emitted] [big] /js/app 
mix-manifest.json 32 bytes   [emitted]   
npm ERR! code ELIFECYCLE 
npm ERR! errno 2 
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. 

我NPM的版本和节点是:

NPM:4.5。 0 节点:v7.8.0

而Laravel 5.4

这里是我的packages.json:

{ 
    "private": true, 
    "scripts": { 
    "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", 
    "watch": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", 
    "watch-poll": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --watch-poll --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", 
    "hot": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", 
    "production": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" 
    }, 
    "devDependencies": { 
    "axios": "^0.15.3", 
    "bootstrap-sass": "^3.3.7", 
    "cross-env": "^3.2.3", 
    "jquery": "^3.1.1", 
    "laravel-mix": "0.*", 
    "lodash": "^4.17.4", 
    "vue": "^2.1.10" 
    }, 
    "dependencies": { 
    "webpack": "^2.3.3" 
    } 
} 

任何解决方案?

+0

你有你的根目录下的'webpack.mix.js'文件? –

+0

你在Windows机器上运行吗? https://laravel.com/docs/5.4/mix#running-mix =>删除文件夹node_modules并重新运行NPM安装这样的:NPM安装--no斌链接 –

+0

我在webpack.mix.js我的根,在这里没有改变任何东西。还我运行的Mac –

我做laravel的全新安装,更新了我的节点和故宫和所有工作正常,按照这些步骤

npm install 
npm install cross-env -D 
npm run dev