I use custom node.js cartridge on openshift icflorescu/openshift-cartridge-nodejs .
How can i set NODE_PATH=. for app start in package.json ? Should i provide it in package.json like that : "start": "NODE_PATH=. NODE_ENV=production node app.js"
, either i should use something like here Dindaleon/hapi-react-starter-kit - some npm package like cross-env
I have line in main app.js file. There is folder named 'config', in the same directory with app.js, in folder config placed file index.js, file index.js have code with 'module.exports = Object.assign({ ...some conifg object... });' . When i delete NODE_PATH=. , node throws "Error: Cannot find module 'config' " .
var config = require('config');
I'm the author of openshift-cartridge-nodejs :-)
Having "start": "node app.js"
in your package.json
should be just enough.
If you take a look at bin/install
, you'll see that NODE_ENV
is already set to production
by default in the cartridge setup script.
Also, I'm not sure what you're trying to achieve by setting NODE_PATH
to .
. There's a single Node.js version installed.
If you're generally interested in how you can set custom environment variables in an OpenShift-deployed application, have a look at the docs here . Basically you'll have to use the rhc
command-line utility like this:
$ rhc env set <Variable>=<Value> <Variable2>=<Value2> -a App_Name
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.