Create a New React.js App

From @jayair on Mon Apr 10 2017 01:00:59 GMT+0000 (UTC)

Link to chapter - http://serverless-stack.com/chapters/create-a-new-reactjs-app.html

Copied from original issue: https://github.com/AnomalyInnovations/serverless-stack-com/issues/29

Hey! I think ‘Create a New React App’ section is miss type which ‘$npx create-react-app notes-app-client’ to ‘$npm create-react-app notes-app-client’ .

sorry, I was missunderstanding create-react-app method. this method can be used after ‘$npm install create-react-app’

I would like to know why you write ‘npx create-react-app notes-app-client’ , please tell me !

The npx command runs the create-react-app NPM package without install it globally for you. This is useful since we don’t run the command very often.

1 Like

It’s right! I don’t know npx command. Let me check. think you give me message!

1 Like

I am having an issue with conflicting versions of eslint. My global installation of npm has version 5.8 of eslint while the create-react-app package requires eslint 6.1. I’ve tried a complete global reinstall of npm but I still get eslint 5.8 as a standard part of install, not 6.1. As a result, the recommendations in the error terminal output won’t fix the problem. (see this SO link for complete description of the problem: https://stackoverflow.com/questions/55788469/start-react-app-fail-on-vscode-by-eslint-version).

What is the best way to manage this issue when I have a global install of npm?

I’m not entirely sure here. You might have to ask the Create React App guys about this.

I had errors where ‘npm start’ didn’t work. I followed steps here to fix:

1 Like

Oh that’s interesting. Never had that issue before. Thanks for reporting.

Hello,

I am new to the forum and serverless. Sounds very interested and I found your amazing pdf which I intend to use as a guide. One question, I have a use case where this guide will be of great help, only difference is I am creating a PWA, should I follow the create react app part and convert that to a PWA or could someone offer some guidance, would be much appreciated, thank you!!

Al

Hmmm I think converting what we have to a PWA shouldn’t be too hard. That said we don’t have specific instructions for it right now.

Just wanted to simplify aidanjl’s comment for those searching for answers. If you previously installed create-react-app globally, you will get this error on the create:

A template was not provided. This is likely because you’re using an outdated version of create-react-app. Please note that global installs of create-react-app are no longer supported.

Then when you run, npm start, you will get this error:

npm ERR! missing script: start

To fix, simply run this command first to uninstall create-react-app globally since it is no longer supported:

npm uninstall -g create-react-app

2 Likes

Oh interesting. Thanks for sharing!

Just to add to this. If you used yarn to install create-react-app like I did you may have to use:

yarn global remove create-react-app

1 Like

(please disregard) …

Is there a specific reason that we are passing --use-npm in order to use npm as a packager? I used yarn to install dependencies that we installed in the previous chapters for backend.

The command given in the chapter:

npx create-react-app frontend --use-npm
cd frontend

I am getting this after deployment -
ReactSite:
REACT_APP_API_URL: undefined
REACT_APP_BUCKET: undefined
REACT_APP_IDENTITY_POOL_ID: undefined
REACT_APP_REGION: undefined
REACT_APP_USER_POOL_CLIENT_ID: undefined
REACT_APP_USER_POOL_ID: undefined

What should i do?

Hello, any help on the query above?

Continuing the discussion from Create a New React.js App:

Hello, According to the guide I installed serverless stack in the frontend directory but when I run the react application it gives me the error saying “sst-env: Cannot find an SST app in the parent directories”
image

Where is the sst.json and in relation to where the React app’s package.json?