forge-react-boiler.nodejs icon indicating copy to clipboard operation
forge-react-boiler.nodejs copied to clipboard

can not run by development

Open teren203 opened this issue 7 years ago • 8 comments

Download your source code and follow the prompts, npm install; set NODE_ENV=development; set HOT_RELOADING=true; npm start, the result image

teren203 avatar May 09 '18 06:05 teren203

I set the environment variable according to environment variable, but the result is the same image

teren203 avatar May 09 '18 07:05 teren203

I downloaded your project again, at npm install, image pls help me,i'm going crazy

teren203 avatar May 09 '18 07:05 teren203

The console log clearly shows NODE_ENV=undefined ...

leefsmp avatar May 09 '18 07:05 leefsmp

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.

leefsmp avatar May 09 '18 07:05 leefsmp

But I set the windows environment variable is useless

teren203 avatar May 09 '18 09:05 teren203

You are doing something wrong, the NODE_ENV is undefined, it's clearly visible in the console log you uploaded

leefsmp avatar May 09 '18 15:05 leefsmp

@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.

  1. npm install --save cross-env
  2. 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.

Jonham avatar Jun 17 '18 11:06 Jonham

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.

R2B3 avatar Sep 30 '18 19:09 R2B3