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.

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:closed
  • Created 6 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
QWp6tcommented, Jun 21, 2017

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

1reaction
decadencecommented, Jun 22, 2017

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?

Read more comments on GitHub >

github_iconTop Results From Across the Web

FIX: Running Scripts is Disabled on this System in Windows ...
Step-by-step instructions to fix the PowerShell error "Cannot be loaded because running scripts is disabled on this system" on Windows 10.
Read more >
Problems "Long Running Script." - Microsoft Community
Click the Tools button, and then click Internet Options. · Click the Advanced tab, select the Disable script debugging Internet Explorer) and ...
Read more >
Fix for PowerShell Script cannot be loaded because running ...
The default execution policy is “strict” on client operating systems like Windows 10 PC. Solution for “cannot be loaded because running scripts ......
Read more >
How to fix Windows Script Host errors on Windows 10 startup?
1. Run the System File Checker. 2. Scan your hard disk for problematic sectors using the CHKDSK utility. 3. Check your disk via...
Read more >
Fix Script Error on Windows 11/10
1] Disable the Script Error Notification · Disable script debugging (Internet Explorer) · Disable script debugging (Other).
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