Open teren203 opened 6 years ago
I set the environment variable according to environment variable, but the result is the same
I downloaded your project again, at npm install, pls help me,i'm going crazy
The console log clearly shows _NODEENV=undefined ...
For the second error it's pretty common, doing a search with the following keyword should get you on possible fixes for it: "npm install can't find python executable", example that thread.
But I set the windows environment variable is useless
You are doing something wrong, the _NODEENV is undefined, it's clearly visible in the console log you uploaded
@teren203
you had set a wrong environment variable:
you should set NODE_ENV
to development
but NOT set ENV
to development
.
this is why you got a undefined
and I don't like changing environment variable every time. so I use a Node helper cross-env
.
- npm install --save cross-env
- add two scripts in package.json under 'scripts.start'
"start-dev": "cross-env NODE_ENV=development cross-env HOT_RELOADING=true node bin/start.js"
"start-prod": "cross-env NODE_ENV=production node bin/start.js",
then you can use npm run start-dev
or npm run start-prod
to work with different NODE_ENV
.
By the way, this only change NODE_ENV for the time you run npm run start-dev
, and won't change your global 'NODE_ENV'. I think it's much more easier to use.
second, this project use sass
, so you need to setup python
on your computer. Because the module node-sass
that compiles sass to css, need python to compile some native modules.
so, install python first.
I had the same issue with the undefined environment variable. Instead of set ...
I used
$env:NODE_ENV="development"
and
$env_HOT_RELOADING="true"
in PowerShell, which works.
Download your source code and follow the prompts, npm install; set NODE_ENV=development; set HOT_RELOADING=true; npm start, the result