Answer the question
In order to leave comments, you need to log in
How to set environment variables (NODE_PATH)?
I constantly encounter the NODE_PATH problem.
For example, package.json says
"scripts": {
"start": "NODE_PATH=$NODE_PATH:./shared node --harmony .",
"dev": "npm run start & webpack-dev-server --progress --color",
"build": "NODE_ENV=production webpack --progress --color -p --config webpack.prod.config.js"
},
Answer the question
In order to leave comments, you need to log in
Each value in scripts is, in fact, an operating system script. That's right, they were written for *nix, and under Windows they will not work even with all environment variables, because the type construction is NODE_PATH=$NODE_PATH:./shared
not valid for the Windows command line interpreter. You need to fix it to something like this SET NODE_PATH=%NODE_PATH%;.\shared
: Most likely, the path to the shared folder should be absolute.
The build command should be changed to something like this:
cmd /C "set NODE_ENV=production && webpack --progress --color -p --config webpack.prod.config.js"
Try on command line (as admin)npm install node-static
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question