question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`npm run dev` cross-env error

See original GitHub issue

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"
  }
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:17 (2 by maintainers)

github_iconTop GitHub Comments

38reactions
david-j-daviscommented, Aug 1, 2017

I removed node_modules, then npm install --global cross-env, followed by removing cross-env from package.json, then npm run dev worked.

35reactions
kamravacommented, May 13, 2017

Problem solved after I removed:

public/mix-manifest.json

Read more comments on GitHub >

github_iconTop Results From Across the Web

Laravel Mix "sh: 1: cross-env: not found error" - Stack Overflow
The error I am getting when I run any npm run command. > Code@1.0.0 dev /home/vagrant/Code > cross-env NODE_ENV=development webpack --progress ...
Read more >
cross-env: command not found error [Solved] | bobbyhadz
Use npx to solve the error "cross-env: command not found", e.g. npx cross-env NODE_ENV=production webpack --config build/webpack.config.js or install the ...
Read more >
cross-env not found on npm run dev - Laracasts
You need to check if that path exists in your node_modules folder (path of the cross-env library). At times it's located within the...
Read more >
`npm run dev` cross-env error · Issue #805 - GitHub
I removed node_modules, then npm install --global cross-env , followed by removing cross-env from package.json, then npm run dev worked. 25
Read more >
cross-env - npm
Run scripts that set and use environment variables across platforms. Latest version: 7.0.3, last published: 2 years ago.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found