Autodesk-Forge / forge-react-boiler.nodejs

React and Node.js boilerplate examples collection: Provides a boilerplate project for using the Forge APIs in a modern React + Node.js web application
MIT License
54 stars 24 forks source link

can not run by development #5

Open teren203 opened 6 years ago

teren203 commented 6 years ago

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

teren203 commented 6 years ago

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

teren203 commented 6 years ago

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

leefsmp commented 6 years ago

The console log clearly shows _NODEENV=undefined ...

leefsmp commented 6 years ago

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.

teren203 commented 6 years ago

But I set the windows environment variable is useless

leefsmp commented 6 years ago

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

Jonham commented 6 years ago

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

R2B3 commented 5 years ago

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.