Script running problems on windows 10
See original GitHub issue- Laravel Mix Version: 1.0.3
- Node Version (
node -v
): 6.9.4 - NPM Version (
npm -v
): 3.10.10 - OS: Windows 10
Description:
I installed laravel-mix with npm install laravel-mix
, copied the webpack.mix.js file to my project folder, copied the following scripts as is told in the docs:
"scripts": {
"dev": "NODE_ENV=development webpack --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "NODE_ENV=development webpack --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"hot": "NODE_ENV=development webpack-dev-server --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"production": "NODE_ENV=production webpack --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
}
First problem I get is, if I try to npm run dev
, I get the NODE_ENV not recognized error that I think is pretty common in windows, so I googled up and found that I should add a ‘SET’ before the NODE_ENV
and a &
for concatenating as in SET NODE_ENV=development & webpack
, but if I try to run npm run dev
again it will hang in 95% forever with no output, I also figured out that if I do not add anything in my webpack.mix.js it won’t hang in 95%, but of course will compile nothing.
Steps To Reproduce:
Init new project in windows
npm init -y
npm install -S laravel-mix
Copy the scripts I mentioned above from official doc
npm run dev
(or any other script)
Note: I need to work in the same project with a team member which uses Windows and I use MacOS, in my Mac everything works perfectly with the doc’s scripts, the problem is: will need to have different scripts to run laravel-mix? Is there a possibility of running with one default script for all platforms?
Thanks!
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (3 by maintainers)
Top GitHub Comments
Install
cross-env
and precede each of the script commands with it, i.e.,cross-env NODE_ENV=...
See also: https://github.com/laravel/laravel/blob/master/package.json#L5-L10
Release notes say:
cross-env has been removed as a dependency of Mix. It doesn’t make sense for us to maintain it. Frameworks like Laravel will already pull in cross-env, but for your personal projects, either open your package.json file and remove the cross-env path from all of your npm scripts, or do npm install cross-env
I don’t undestand. Do I need it or not? It says we don’t need cross-env but then it suggests install it. And why we don’t need it if Windows fails without it?