Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having issue with building and starting the project #158

Closed
Nitin2392 opened this issue Feb 1, 2021 · 4 comments
Closed

Having issue with building and starting the project #158

Nitin2392 opened this issue Feb 1, 2021 · 4 comments

Comments

@Nitin2392
Copy link

Nitin2392 commented Feb 1, 2021

I just started the course and was able to clone and setup the project locally. I was having issues with running node setup because there is a space between my firstname and lastname and npx wasn't liking that. I was able to fix that but there seems to be another issue now when I run npm run build or npm start.

C:/Users/Nitin Rangarajan/source/repos/EpicReact/react-fundamentals/src/exercise/01.md (C:/Users/Nitin Rangarajan/source/repos/EpicReact/react-fundamentals/node_modules/babel-loader/lib!C:/Users/Nitin Ran

SyntaxError: C:\Users\Nitin Rangarajan\source\repos\EpicReact\react-fundamentals\src\exercise\01.md: Support for the experimental syntax 'jsx' isn't currently enabled (18:10):

  16 |   ...props
  17 | }) {
> 18 |   return <MDXLayout {...layoutProps} {...props} components={components} mdxType="MDXLayout">
     |          ^
  19 |     <h1 {...{
  20 |       "id": "basic-javascript-rendered-hello-world"
  21 |     }}>{`Basic JavaScript-rendered Hello World`}</h1>

Add @babel/preset-react (https://git.io/JfeDR) to the 'presets' section of your Babel config to enable transformation.
If you want to leave it as-is, add @babel/plugin-syntax-jsx (https://git.io/vb4yA) to the 'plugins' section to enable parsing.
@Nitin2392
Copy link
Author

Nitin2392 commented Feb 1, 2021

I did some googling and found that this issue can be fixed by changing the "main" section in package.json to the follows:

Change from
"main": "src/index.js",
to
"main": "./build/src/index.js",

I am going to leave this issue open to confirm if this is the right approach to solve this problem.

@kentcdodds
Copy link
Member

Hi @Nitin2392,

This is strange. Did the installation step of the setup script not work for you?

In your suggestion, are you talking about this package.json main property? Because ./build/src/index.js doesn't exist so I'm not sure how this could fix anything 🤔

@Nitin2392
Copy link
Author

Nitin2392 commented Feb 1, 2021

Hey @kentcdodds! The installation step of the setup didn't work for me at first but that was due to a npx error with a space existing between my First and Last names in the C/User/{name} folder path.

The setup script did not throw this babel error.

Yes, that's the main property I changed in package.json. Hmm, interesting that this fix worked for me!

@kentcdodds
Copy link
Member

Hmmm... Yeah, this is odd. We can keep this issue around in case it helps anyone else, but I don't think there's much we can do about it from now so I'll close it. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants