简体   繁体   中英

Heroku Run Npm “Command Not Found”

Based on this question , when I try to run the suggested answer (heroku run npm run "script name") I get "bash: npm: command not found". I'm trying to trigger the script on a deployed meteor NodeJS app to Heroku (node version 4.8.2 and npm version 4.6.1). Any solutions to why?

package.json

{  
  "name": "admini_meteor",  
  "private": true,  
  "scripts": {
    "deploy": "MONGO_URL=mongodb://52.1.130.211/cloud meteor"
  },
  "dependencies": {
    "babel-runtime": "^6.23.0",
    "bcrypt": "^1.0.2"
  }
}

Procfile web: npm run deploy

I am no expert but I will try to give you a hint of your problem because I had the same one. Everything is in the docs you just need to read it. So far the web process in the one taking care of running the actual app/server like here . But also how is your project structure? Heroku detects you are developing a node project (because of package.json file in root directory) so it should install npm for you.

In my case I was developing a Laravel app, therefore, it created a PHP application without node and npm. There is a way to tell heroku you need both environments like state here

You need to add nodejs in your buildpack 在此处输入图片说明

And then deploy your app again! That's all!

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM