Skip to content

Open a new project and the page shows "[HMR] Hot Module Replacement is disabled" #1634

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
WustLCQ opened this issue Jun 20, 2018 · 7 comments

Comments

@WustLCQ
Copy link

WustLCQ commented Jun 20, 2018

Version

3.0.0-rc.3

Reproduction link

https://github.com/vuejs/vue-cli

Steps to reproduce

npm install [email protected]
vue create vue-test
choose default
cd vue-test
npm run serve

What is expected?

Open the new page show the app content

What is actually happening?

The page is not automatically opened. Open localhost:8080,the page shows blank, and the console shows "Uncaught Error: [HMR] Hot Module Replacement is disabled."


I have tried many verisons of vue-cli, such as rc.2, beta.16, beta.10, this problem always appears. But in my friend's pc, he use the same version of vue-cli as me, do the same operations to create a new project, it works well.

@podlebar
Copy link

check: #1617 and the last comments form @LinusBorg.

i had another issue but that defined NODE_ENV in .zshrc also caused this problem on my machine.

@WustLCQ
Copy link
Author

WustLCQ commented Jun 20, 2018

@podlebar
Yes, I also have NODE_ENV='dev' in my .zshrc file. After I delete it and create another project, it works well now. But my friends's pc has also defined NODE_ENV in .zshrc, and his new project can normally work....I don't know why.

@podlebar
Copy link

Maybe he is using still a older version of vue-cli.
the change that breaks it for you came in beta-16.

@LinusBorg
Copy link
Member

LinusBorg commented Jun 20, 2018

But my friends's pc has also defined NODE_ENV in .zshrc, and his new project can normally work....I don't know why.

maybe he had it set to a different value, i.e. NODE_ENV=development

...which would be the exact value vue-cli is expecting.

I think it's never a good idea to have a predefined value for NODE_ENV in your environment.

Many projects rely on specific values for NODE_ENV to decide how to behave, and having this injected in the background will make it hard to track a bug, since it's only happening on your machine ...

@WustLCQ
Copy link
Author

WustLCQ commented Jun 21, 2018

@podlebar @LinusBorg thx!

@c0urg3tt3
Copy link

with windows 10 and vue 3.0.0-rc.1 i was hitting the same bug last night
"Uncaught Error: [HMR] Hot Module Replacement is disabled."
i looked at my windows env but no NODE_ENV, for an eventual .zshrc, none ...
i was puzzled as what is reported here is related to NODE_ENV ...
my .env file was also not used ...

after putting a console.log in @vue\cli-service\lib\util\loadEnv.js i found that the process.env contained a NODE_ENV value equal to "undefined" therefore the condition failed because "undefined" is a string and not a type, so process.env was not overwritten with the config env.

using cross-env to specify the NODE_ENV in package.json solved my problem
"serve": "cross-env NODE_ENV=development vue-cli-service serve",

@Akryum
Copy link
Member

Akryum commented Jun 23, 2018

@c0urg3tt3 You are not on the latest rc 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants