Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Next Steps with Create React App

Alan McClenaghan
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alan McClenaghan
Full Stack JavaScript Techdegree Graduate 56,500 Points

npm run build – now what?

I got my app working fine on the local server and ran npm run build.

Now what do I do with it? Can I display the app on my portfolio website? If so, how do I go about this? Can I simply upload it like a static website or do I need to do a load of configuring. If so, what?

The index.html file in the build folder doesn't display anything when I open it on a browser, Will this change if it is on my web server with any additional configuring?

Is there another course that shows how this is done?

2 Answers

Alan McClenaghan
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alan McClenaghan
Full Stack JavaScript Techdegree Graduate 56,500 Points

Finally I got it to work!

After the run build had completed, a message in the terminal stated:

The project was built assuming it is hosted at the server root. You can control this with the homepage field in your package.json. For example, add this to build it for GitHub Pages:

"homepage" : "http://myname.github.io/myapp",

By simply adding "homepage": "http://mywebsite.com/relativepath", (replacing the generic path with the path you want to use) in the package.json and then rerunning npm run build, the new build folder can then be renamed and added to your website. Here it is at my website:

http://alanmcclenaghan.com/react/search-app/index.html