Reputation: 808
I want to try the serve package with a React App by doing the following step:
npm install serve --s
then replace the npm start command in package.json like this:
scripts": {
"start": "serve -s build",
"build": "react-scripts build",
"test": "react-scripts test",
...
},
and then I run npm start i got the error in the console "Uncaught SyntaxError: Unexpected token '<'" etc
however if I uninstall serve --s and put back the package.json like this :
scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
...
},
and then run npm start again it work fine on my local machine, so i think i am doing something wrong in the process and i would like to know why I have issue with the serve package.
Upvotes: 0
Views: 1165
Reputation: 164
Looks like you haven't built your /build
folder with app bundle. It must be like this:
npm start
- to run and edit codenpm run build
- to build a bundle(creates/rebuild a /build
folder)serve -s build
- serve/start the /build
folderUpvotes: 2