Create-react-app: react-scripts build only builds the original template

Created on 12 Nov 2017  路  3Comments  路  Source: facebook/create-react-app

Is this a bug report?

yes

Can you also reproduce the problem with npm 4.x?

yes

Which terms did you search for in User Guide?

react-scripts
build

Environment

  1. node -v: v8.9.0
  2. npm -v: 5.5.1
  3. yarn --version (if you use Yarn):
  4. npm ls react-scripts (if you haven鈥檛 ejected): [email protected]

  5. Operating system: Ubuntu 16.04 LTS

  6. Browser and version (if relevant): chrome 62

Steps to Reproduce

  1. install create-react-app with npm i -g create-react-app
  2. create a react app using create-react-app
  3. change something in the html part in App.js and save
  4. npm start works fine and displays changes
  5. build the app using npm run build
  6. serve the build version using 'serve build' command
  7. serve serves the original react template
  8. tried to serve with a python flask server the same page appears

Expected Behavior

after build, serve is expected to serve the built version

Actual Behavior

it's serving the original react template, a version that doesn't exist!

Reproducible Demo

tried it with a multiple create-react-app projects, the same always happens

Most helpful comment

You might be having issues with the service worker caching your builds. Try refreshing after a change, the new build should show up, no need to clear your cache. Also, you can opt out of caching as the build is run in the context of production by default. You shouldn't have this problem during development.

All 3 comments

Tried to verify on Windows 10, node 9.1.0 (all other versions same). Cannot reproduce.

@SirajKakeh can you please check a couple of things which may help others narrow down the problem?

  • is npm run build creating the build directory in your project? (may be try deleting your build directory first)

  • Clear chrome cache or try in in-private mode (in case chrome has cached the earlier response)

Edit: Also, just noticed that you are serving by: serve build but without the -s switch as the message from CRA suggests. I am not sure if that makes a difference with Serve, but can you please try that first?

@Dubes
cleared the chrome cache and it worked thanx :+1: .
Tried to open the build version on firefox and it showed the changed version, but whenever I build a newer version I always have to clear the browsers cache on whichever browser I use first

You might be having issues with the service worker caching your builds. Try refreshing after a change, the new build should show up, no need to clear your cache. Also, you can opt out of caching as the build is run in the context of production by default. You shouldn't have this problem during development.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gaearon picture gaearon  路  86Comments

jantimon picture jantimon  路  154Comments

akctba picture akctba  路  80Comments

gaearon picture gaearon  路  152Comments

andreypopp picture andreypopp  路  96Comments