laravel-mix: `npm run dev` cross-env error
Laravel 5.4.23 Node.js version: 7.7.2 npm version: 4.1.2 LaraDock on Ubuntu 16.04
laradock@10e308159f66:/var/www$ npm run dev
Here is the error:
> @ dev /var/www
> npm run development
> @ development /var/www
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
undefined:1
SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at Manifest.read (/var/www/node_modules/laravel-mix/src/Manifest.js:138:21)
at new Manifest (/var/www/node_modules/laravel-mix/src/Manifest.js:9:43)
at Mix.initialize (/var/www/node_modules/laravel-mix/src/Mix.js:27:25)
at Object.<anonymous> (/var/www/node_modules/laravel-mix/setup/webpack.config.js:35:5)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
npm ERR! Linux 4.9.14-200.fc25.x86_64
npm ERR! argv "/home/laradock/.nvm/versions/node/v7.7.2/bin/node" "/home/laradock/.nvm/versions/node/v7.7.2/bin/npm" "run" "development"
npm ERR! node v7.7.2
npm ERR! npm v4.1.2
npm ERR! code ELIFECYCLE
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 '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! 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! 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! 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 ERR! Please include the following file with any support request:
npm ERR! /var/www/npm-debug.log
npm ERR! Linux 4.9.14-200.fc25.x86_64
npm ERR! argv "/home/laradock/.nvm/versions/node/v7.7.2/bin/node" "/home/laradock/.nvm/versions/node/v7.7.2/bin/npm" "run" "dev"
npm ERR! node v7.7.2
npm ERR! npm v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ dev script 'npm run development'.
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! npm run development
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 ERR! Please include the following file with any support request:
npm ERR! /var/www/npm-debug.log
And Here is package.json :
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env 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"
}
}
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 17 (2 by maintainers)
I removed node_modules, then
npm install --global cross-env, followed by removing cross-env from package.json, thennpm run devworked.Problem solved after I removed:
public/mix-manifest.jsonI’m facing the exact same issue but removing public/mix-manifest.json didn’t fix it… Here is my log…
Laravel 5.4.22 Node.js version: 7.1.0 npm version: 4.2.0 no homestead or laradock
UPDATE :
Fixed issue by running
npm install --global cross-envHad to do
chmod -R u+x .in the root folder of the project to get it to work. Tried everything above but of course you need the right permissions to start with!I figured that I had not ran npm install, so it threw a similar problem, just posting it here incase this fixes for others.
Deleting package-lock.json & node_modules/ folder and running npm install worked for me
@Elypson Try installing webpack under global npm.
npm i -g webpack@latest