Monday, 22 May 2017

Heroku: npm Failure - index.js not found

I am trying to set up my "web app" on Heroku. When I double click on my index.html it shows up in my browser but the app fails to open in Heroku. I am accessing my files through github, which is working fine.

In oder to set up my working environment I followed this tutorial exactly: https://www.kirupa.com/react/setting_up_react_environment.htm

After reading about my initial errors in Heroku:

1.) I added the Node Version (But not the npm Version since I only saw how to add one or the other and not both.)

"engines": {
    "node": "7.10.0"},

2.) I changed the Script to:

"scripts": {
      "start": "node index.js"},

That was straight forward enough, but now after running npm start, I see a distinct error (also reflected in the https://www.npmjs.com browser test):

Error: Cannot find module '/Users/MyUser/MyFolder/index.js'

Now, due to that tutorial above, I only have "index.jsx" located within an additional folder like: MyFolder/dev/index.jsx

I tried to change the file extension in package.json and or the file path, but no matter what I do, the file is not being found. I am guessing that ".jsx" should automatically be recognised as ".js", but I think that only because of the way that the tutorial was written...

Please help me figure out how to run npm start without error. Thank you in advance!



via April

No comments:

Post a Comment