Guys can you please help me on this I have trouble run npm run dev for my Laravel Mix. I followed links below but still error exist. Do i have a problem on my OS? I tried to remove node_modules, run npm install --global cross-env. and run NPM install again.
https://github.com/JeffreyWay/laravel-mix/issues/478
Laravel 5.4 'cross-env' is not recognized as an internal or external command
Here are my versions:
> @ development C:\xampp\htdocs\codetinerant > cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js 'cross-env' is not recognized as an internal or external command, operable program or batch file. npm ERR! code ELIFECYCLE npm ERR! errno 1 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. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Garciano\AppData\Roaming\npm-cache\_logs\2018-02-17T10_08_34_901Z-debug.log
cross-env vs cross-env-shell The first one executes commands using cross-spawn , while the second one uses the shell option from Node's spawn . The main use case for cross-env-shell is when you need an environment variable to be set across an entire inline shell script, rather than just one command.
> npm --version 'npm' is not recognized as an internal or external command, operable program or batch file. The error above happens when the Windows operating system doesn't know what to do with the npm command. To fix the error, you need to make sure that the Node executable file is available under your PATH setting.
cross-env makes it so you can have a single command without worrying about setting or using the environment variable properly for the platform. Just set it like you would if it's running on a POSIX system, and cross-env will take care of setting it properly.
Use npx to solve the error "'nodemon' is not recognized as an internal or external command, operable program or batch file", e.g. npx nodemon server. js or install the package globally by running npm install -g nodemon and make sure your PATH environment variable is set up correctly.
"cross-env" is not recognized as an internal or external command, program or batch file executable Navigation #1 by (1 votes) #2 by (0 votes) 0 I am trying to execute the command: npm run watchto compile the files in laravel 5.6.
‘cross-env’ is not recognized as an internal or external command, operable program or batch file. Hey if you are getting some error like (‘cross-env’ is not recognized as an internal or external command, operable program or batch file.) in your Node please follow the steps which i have mentioned in following:-
This goes in your package.json file: This may have changed in more recent versions of Laravel but the gist is that you should change cross-env to node_modules/cross-env/dist/bin/cross-env.js. Show activity on this post. Show activity on this post.
First, run:
rm -rf node_modules rm package-lock.json yarn.lock npm cache clear --force
Then run the command
npm install cross-env npm install
and then you can also run
npm run dev
Did you try specifying the path to cross-env
as suggested by dwoodward on the Github issue you linked? This goes in your package.json
file:
"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"
This may have changed in more recent versions of Laravel but the gist is that you should change cross-env
to node_modules/cross-env/dist/bin/cross-env.js
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With