When I deploy my node app to the Heroku, after it's done installing its dependancies, it does an "npm run postinstall" as per the docs, however the NODE_ENV variable isn't set, so my app is being build in development mode.
Simple solution would be to add NODE_ENV=production to the front, but this would cause issues when deploying to staging. Their documentation says that the variable should be set, but it's not. What am I missing?
Thanks!
You can simply go to heroku and set the NOD_ENV variable by doing the following in your terminal:
heroku config:set NODE_ENV=production
Or you can simply go to heroku settings and set the config vars.
Related
I have a Heroku dyno running my React application. I have added npm packages since my last push to my local instance of the site. When I push to Heroku, it deploys but it is missing the packages and throws ReferenceErrors saying the packages don't exist.
The packages are in package.json. What could be the reason Heroku is not detecting the new packages?
Try preventing heroku from caching your node_modules. i.e:
heroku config:set NODE_MODULES_CACHE=false -a YOUR_APP_NAME
This command forces heroku to install your package.json afresh after every new build.
while deploying a Phoenix project, on Heroku it is saying mix command not found
I checked the Buildpacks of elixir and Phoenix are installed, pushed the code also before running the task.
tried after doing changes in the bashrc file (commented the code for "if not running interactively, don't do anything")
also tried with a change in the .profile file ($HOME/.asdf/asdf.sh)
although "mix phoenix.server" is working fine
heroku run 'POOL_SIZE=2 mix test.task'
Running POOL_SIZE=2 mix test.task on ⬢ evening-hollows-99899... up, run.2532 (Free)
bash: mix: command not found
I am totally new to Meteor. I am trying to run Reaction Commerce on my local machine. I found someone pointed that set METEOR_DISABLE_OPTIMISTIC_CACHING = 1 can speed up the meteor loading time. However, I don't know how to set this thing up on Window 10.
Does anyone know about this?
METEOR_DISABLE_OPTIMISTIC_CACHING is an environment variable.
You can set it in three ways:
system-wide in control panel
for a specific shell by using SET METEOR_DISABLE_OPTIMISTIC_CACHING=1 in a command prompt before running meteor. Easiest to use in a .bat file
in an npm script using the cross-env package
I recommend using cross-env. First meteor npm install --save cross-env
Then add a start script to package.json:
"scripts": {
"start": "cross-env METEOR_DISABLE_OPTIMISTIC_CACHING=1 meteor run"
}
now when you run npm start it will set the environment variable just for that one running instance of meteor
I am trying to follow the steps of the following StackOverflow answer:
Running ChromeDriver with Python selenium on Heroku
But I can't figure out how to do this part.
Question
How do I create an environment variable GOOGLE_CHROME_BIN, with the path of chrome on heroku: /app/.apt/usr/bin/google-chrome and an environment variable called CHROMEDRIVER_PATH with the path of chromedriver on heroku: /app/.chromedriver/bin/chromedriver?
Using Heroku CLI for your app:
$ heroku config:set GOOGLE_CHROME_BIN=/app/.apt/usr/bin/google-chrome
$ heroku config:set CHROMEDRIVER_PATH=/app/.chromedriver/bin/chromedriver
Or you can do this by editing the config vars on your app’s settings tab on Dashboard
Is there a way to tell pm2 to leave stderr and stdout alone (as opposed to writing to files)?
I'm using pm2 on Heroku using this gist as my model. Everything seems to work perfectly except that I've lost any ability to log from within my app. They don't show up in the Heroku logs and the files that pm2 creates aren't accessible to me on Heroku's file system (or I can't find them).
In your package.json:
"scripts": {
"preinstall": "npm i -g pm2 && pm2 install pm2-logrotate"
}
In your Procfile:
web: pm2 start app.js && pm2 logs all
We just created the official PM2 documentation, here is how to integrate PM2 with Heroku while printing the logs:
http://pm2.keymetrics.io/docs/usage/use-pm2-with-cloud-providers/#heroku-google-app-engine-azure
Alex