I've got a working Parse Server running on Heroku, and I'm trying to get my Twilio cloud code working. As soon as I add var twilio = require('twilio')(twilioAccountSid, twilioAuthToken); to my main.js, the app breaks. The migration guide from Parse.com (https://github.com/ParsePlatform/parse-server/wiki/Migrating-an-Existing-Parse-App#3-cloud-code) shows that Twilio should be installed from the "official npm module". How does one do that? Thanks for any help!
I had to modify package.json, adding "twilio": "~2.9.0" as a dependency. I was also able to troubleshoot this better by installing the Heroku toolbelt, and running heroku logs --tail --app your_app_name from the terminal. I originally installed twilio via the Heroku toolbelt, by running heroku run npm install twilio --app your_app_name, but I'm not sure if that was required or not.
Related
I'm trying to deploy a Node.js (Remix) application to an Azure App Service instance. After installing the npm packages, the post-install script must run for the Remix app to eventually work. The post-install script is npx remix setup node.
Unfortunately, the deployment fails because of the following reason:
npm ERR! could not determine executable to run
I get the same error when trying to use other npx commands, as npx prisma generate. I tried npm exec as well instead of npx.
Thank you in advance!
In startup command try using npx serve -s build/
Also, under your app service Settings blade check all the general settings.
Make sure that your web.config was published along with your app.
i have been trying to deploy a node.js app on heroku. the app run successfully on local machine and it build successful with git heroku push master. but when try to open the app on heroku, it shows a blank page and on the console i got the bellow error.
so i my app i uses owlcarousel, and react -carousel. thanks
Try running it locally with NODE_ENV=production node index.js to see if you can reproduce the error like that. Check the .gitignore to see if you are not leaving out some important files. Check the package.json If a module that is included in the package.json is missing from the build or the production app, it may have been removed by Heroku during pruning. And also, in order to create a smaller slug size for apps, the buildpack will prune out the devDependencies from the package.json at the end of the build, so that the slug will only include the dependencies that are listed at runtime. If there is a dependency that is in the devDependencies that is needed after the prune occurs, move the dependency to dependencies, so it is not removed. Look here for more info, troubleshooting Node.js deployment on Heroku.
I am very very new to React JS and have tried to install it on my VPS server that is running Cent OS.
Node.js seems to be working,
I have build a React project using the following code as a root level user on SSH:
npx create-react-app my-react-project
cd my-react-project
npm start
but when trying to view in browser I get a blank page (instead of react js default template)?
I see many people install this locally but I haven't found any examples on a hosted VPS, is this something I am doing wrong?
Any help would be much appreciated, thanks!
if you have ssh access to your VPS, the rest is pretty the same as your local environment.
You can copy/paste your project to your CentOS host and use the following commands in order to run it:
cd your_project_folder_which_includes_package_json_file
npm install
npm start
Also, if you are using this server as a production host, You should consider getting a production build of your React app on your local env by running npm run build and then publishing the build folder on your server and serving it using a static file server or using a reverse-proxy such as Nginx as a static server.
Actually this page in React documentation does a good job in explaining the details of deploying a React app, I encourage you to take a look at it.
I have basically modified this app
https://github.com/heroku/node-js-getting-started.git
Now am trying to deploy in Heroku
My Procfile has this line
web:node index.js
And when I run this command locally,there are no probs..
However if I try to open the link in my browser after following all the steps in https://blog.risingstack.com/node-hero-deploy-node-js-heroku-docker/
I get an error
On checking the logs using heroku logs command I am getting 'node command not found'
Anyone knows the prob?
P.S : I tried changing Procfile contents to npm start but that doesnt launch index.js in the browser.
I suspect that you have not set the buildpacks. Buildpacks tells heroku which kind of application is yours.
Use the below command to set the application of type nodejs.
heroku buildpacks:set heroku/nodejs
And make sure that you have a package.json file in the root of the project which is read by heroku to install the project dependencies.
Why don't you try this below in your Procfile.In my case it runs nicely.
web npm install
You just need to add nodejs buildpack on heroku settings app,
after that you will be able to use npm commands.
Under scripts in package.json I have the following.
'refresh': node refresh db
Is there a way to trigger this particular npm script on a NodeJS app deployed on Heroku.
Yes:
$ heroku run npm run refresh
Per the Heroku Node.js Documentation, you can add pre and post install scripts. In addition, you can add scripts that can be triggered by environment variables.
You can also do this using only the browser; Just log in to manage your app in the heroku dashboard (https://dashboard.heroku.com/apps/[app_name]) and there click on the right side of it:
More > Run console
Then you can run any command:
command line in heroku
https://devcenter.heroku.com/changelog-items/1137