Laravel Mix "sh: 1: cross-env: not found error"
You need to make cross-env
working globally instead of having it in the project.
run
$ sudo npm install --global cross-env
--- update ---
But, my advice is to avoid executing npm run ...
on the guest homestead, because it is very slow and because there is no benefit in it.
No matter where you build the assets they are going to be executed in the browser. So you better install npm
on your host computer and build the assets there.
First check if cross-env module is installed. If not, run:
npm install cross-env
After that you need to go to the node_modules
folder.Then find cross-env
folder. Go inside and find cross-env.js
.
In my case it was node_modules/cross-env/dist/bin/cross-env.js
You need to change path to cross-env.js
in scripts
section in your package.json
file.
{ "private": true, "scripts": { "dev": "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_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", "hot": "node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development webpack-dev-server --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", "production": "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" },........}