question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

npm run build problem

See original GitHub issue

I have got my project done,but when I npm run build ,I got the build folder,but when I open the index.html in build folder by chrome ,I just got a blank page,but actually I want to get it can be visual .

the index.html codes in build folder like this:

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="shortcut icon" href="/static/media/favicon.fd73a6eb.ico"><title>React App</title><link href="/static/css/main.9a0fe4f1.css" rel="stylesheet"></head><body><div id="root"></div><script type="text/javascript" src="/static/js/main.f39a5fd1.js"></script></body></html>

what can I do to build the project? p.s I have read the USER GUIDE ,but not get a perfect answer.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:21 (7 by maintainers)

github_iconTop GitHub Comments

10reactions
gaearoncommented, Sep 8, 2016

When you run npm run build it displays instructions on how to run the server:

npm i -g pushstate-server
pushstate-server build
open http://localhost:9000

You need to run a static server for these files, just like you would need to do it in production. Opening just HTML file from file:// URL won’t work because the static paths are absolute rather than relative. And they are absolute because we want client-side routing to work (which does not work with relative asset URLs).

I hope this helps!

6reactions
gaearoncommented, Mar 1, 2017

@BrianNW

  "homepage": "https://github.com/BrianNW/musicMaster",

is not the correct setting. You need to use the deployment URL as the homepage setting:

  "homepage": "https://BrianNW.github.io/musicMaster",

Additionally, you need to run npm run build after changing that setting. Please follow this guide exactly, and it will work.

If not, please file a new issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Errors when running npm run build - node.js - Stack Overflow
Im trying to create my built folder for a react project, but I get this error when I run the command 'npm run...
Read more >
The command `npm run build` is not working since updating to ...
Hi there, i've updated the sources to OJS 3.2 and the command npm run build mentioned in README.md returns with errors. I followed...
Read more >
Error when running npm run build : r/react - Reddit
I have a react app done and am attempting to learn how to deploy it for the first time. I type npm run...
Read more >
Problem with npm run build - Questions - n8n community
I download from git the project and I get an error when try running np, run build.
Read more >
Error: Command "npm run build" exited with 1 - Get Help
Remove node_modules folder from project root; Delete package-lock.json; Run npm i; Profit. mr.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found