Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
439 views
in Technique[技术] by (71.8m points)

express - Trying to set package.json for MERN app in Heroku

I am a bit new to this area and I I am missing something fundamental. I have a very basic shell of an application:

Client path: src/index.js

Server path: server/index.js

Procfile: web:node server/index.js

root package.json:

    "dev": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",

How do I tell heroku where the client files are? Do I need a "start" script in the root's package.json? From the examples that I've seen they usually had "node " to start the express server. Do I need to set up something like webpack for the client server?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Please ignore. I have done this in the past and got myself turned around by looking through various guides. It was a comedy of errors, starting with mistakenly having type:module in the package.json (I had created it elsewhere originally) and that put me down a rabbit hole of making the wrong decisions.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...