title: Node.js Heroku Deployment on Mac - sh: 1: nodemon: not found / npm ERR! `nodemon fileName.js` / npm ERR! Failed at the...start script
body: <h1>Deploying on <code>Heroku</code> with <code>Node.js</code> using <code>Mac</code></h1>
  <p><strong>My issue:</strong></p>
  <pre><code>State changed from starting to crashed &amp;&amp;  
  sh: 1: nodemon: not found &amp;&amp;  
  Failed at...start script &amp;&amp;
  status 1...code=H10
  </code></pre>
  <p>After creating my front-end, with <code>React</code>, back-end server, with <code>node.js</code>/<code>express.js</code>, and database, with <code>PostgreSQL</code>, I attempted to deploy my server on <code>Heroku</code> with <code>Git</code>. Since I already had <code>Git</code>, I moved onto <code>Heroku CLI</code></p>
  <p><em>First, from the <code>terminal</code> in my server...</em></p>
  <pre><code>brew install heroku/brew/heroku
  heroku create
  git remote -v
  git push heroku master
  </code></pre>
  <p><em>If this is not your first time using <code>Heroku</code>...</em></p>
  <pre><code>heroku git:remote -a theUrlYouWant
  git push heroku master
  </code></pre>
  <p><em>...otherwise...<code>Heroku</code> dynamically assigns your app a port, so you can't set the port to a fixed number. Heroku adds the port to the env:</em></p>
  <pre><code>app.listen(process.env.PORT || 3000, () =&gt; {  
    console.log(`app is running on port ${process.env.PORT}`);
  })  
  </code></pre>
  <p><em>...if you added port:</em></p>
  <pre><code>git add .
  git commit -m &quot;adding port&quot;
  git push heroku master
  </code></pre>
  <p><em>...finally, from my terminal in server:</em></p>
  <pre><code>➜ folderName git:(master) heroku open  
  ➜ folderName git:(master) heroku logs --tail
  
  2019-05-08T18:07:23.253827+00:00 heroku[web.1]: Starting process with command npm start  
  2019-05-08T18:07:25.323748+00:00 heroku[web.1]: State changed from starting to crashed  
  2019-05-08T18:05:17.074233+00:00 app[web.1]: &gt; nodemon fileName.js  
  2019-05-08T18:05:17.074235+00:00 app[web.1]:   
  2019-05-08T18:05:17.098124+00:00 app[web.1]: sh: 1: nodemon: not found  
  2019-05-08T18:05:17.102512+00:00 app[web.1]: npm ERR! file sh  
  2019-05-08T18:05:17.102801+00:00 app[web.1]: npm ERR! code ELIFECYCLE  
  2019-05-08T18:05:17.103068+00:00 app[web.1]: npm ERR! errno ENOENT  
  2019-05-08T18:05:17.103239+00:00 app[web.1]: npm ERR! syscall spawn    
  2019-05-08T18:05:17.104259+00:00 app[web.1]: npm ERR! app@1.0.0 start: nodemon fileName.js  
  2019-05-08T18:05:17.104361+00:00 app[web.1]: npm ERR! spawn ENOENT  
  2019-05-08T18:05:17.104553+00:00 app[web.1]: npm ERR!  
  2019-05-08T18:05:17.104692+00:00 app[web.1]: npm ERR! Failed at the app@1.0.0 start script.  
  2019-05-08T18:05:17.104841+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above. 
  
  [...]
  
  2019-05-08T18:05:17.171915+00:00 heroku[web.1]: Process exited with status 1  
  2019-05-08T18:05:37.338695+00:00 heroku[router]: at=error code=H10 desc=&quot;App crashed&quot; method=GET path=&quot;/&quot; host=yourURL.herokuapp.com request_id=hidden fwd=&quot;ip&quot; dyno= connect= service= status=503 bytes= protocol=https  
  </code></pre>