Laravel-mix: npm error with "SyntaxError: Unexpected end of JSON input"

Created on 7 Mar 2017  路  10Comments  路  Source: JeffreyWay/laravel-mix

  • Laravel Mix Version: 0.8.8
  • Node Version (node -v): 7.6.0
  • NPM Version (npm -v): 4.3.0
  • OS: homestead-7 on Windows 10

Description:

Breaks at npm run dev with npm telling me

SyntaxError: Unexpected end of JSON input
    at Object.parse (native)
    at Manifest.read (/home/vagrant/fyp/node_modules/laravel-mix/src/Manifest.js:132:21)
    at new Manifest (/home/vagrant/fyp/node_modules/laravel-mix/src/Manifest.js:14:43)
    at Mix.initialize (/home/vagrant/fyp/node_modules/laravel-mix/src/Mix.js:49:25)
    at Object.<anonymous> (/home/vagrant/fyp/node_modules/laravel-mix/setup/webpack.config.js:18:5)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at requireConfig (/home/vagrant/fyp/node_modules/webpack/bin/convert-argv.js:96:18)
    at /home/vagrant/fyp/node_modules/webpack/bin/convert-argv.js:109:17
    at Array.forEach (native)
    at module.exports (/home/vagrant/fyp/node_modules/webpack/bin/convert-argv.js:107:15)

npm ERR! Linux 4.4.0-51-generic
npm ERR! argv "/usr/local/bin/node" "/usr/bin/npm" "run" "dev"
npm ERR! node v6.10.0
npm ERR! npm  v4.3.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ dev: `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 @ dev 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.

Steps To Reproduce:

update to most recent package.json
npm install --no-bin-links
npm run dev

Most helpful comment

Sorry, I forgot to inform, here for me it was resolved by deleting the files:

public/mix-manifest.json
public/css/app.css
public/js/app.js

After removing, I deleted the folder node_modules, installed all the packages again with npm install and finished! Worked perfectly.

But anyway my mix-manifest.json file before solving the problem, was always empty.

All 10 comments

Same problem here, however I'm using Mac!

What does your mix-manifest.json file look like?

Sorry, I forgot to inform, here for me it was resolved by deleting the files:

public/mix-manifest.json
public/css/app.css
public/js/app.js

After removing, I deleted the folder node_modules, installed all the packages again with npm install and finished! Worked perfectly.

But anyway my mix-manifest.json file before solving the problem, was always empty.

Just delete
public/mix-manifest.json

and then run
npm run watch-poll or npm run dev

It will work fine!

I'm posting this here in case others have issues with this on Windows 10.
I kept receiving this error on a fresh install and tried all the various fixes. None of them worked. Until I noticed that 'npm run dev' was looking at a package.json file in my Windows user directory. It was empty and simply deleting it fixed my issues.

I ran this command and awesome, error has gone.
npm cache clean --force

somebody, please see my problem once.
while installing webpack using npm I am getting the following problem:

C:\Users\jhapi\Desktop\Reactjs>npm install --save-dev webpack
npm ERR! Unexpected end of JSON input while parsing near '...le-loader":"0.1.x","s'

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\jhapi\AppData\Roaming\npm-cache_logs\2017-12-06T15_49_00_212Z-debug.log

@vrammohan benjamindoe sos un crack

Might be because of AV.

shift. I lost 2 days because of this bug
Thanks for solution!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pixieaka picture pixieaka  路  3Comments

amin101 picture amin101  路  3Comments

dtheb picture dtheb  路  3Comments

kpilard picture kpilard  路  3Comments

Micaso picture Micaso  路  3Comments