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

ERROR in ./src/index.jsx SyntaxError: Unexpected token (13:4) #9

Open
wireless-road opened this issue Oct 3, 2020 · 2 comments
Open

Comments

@wireless-road
Copy link

wireless-road commented Oct 3, 2020

Hello.
Trying to make it working. Even ubunu reinstalling didn't help.
Did everything as explained here:
https://jasonwatmore.com/post/2017/12/07/react-redux-jwt-authentication-tutorial-example
Installed node, npm, npx, nvm:

$ node -v
v12.18.4
$ npm -v
6.14.6
$ nvm -v
0.36.0
$ npx -v
6.14.6

Installing passes well:
$ npm install
But trying to start it gives me following:

 npm start

> [email protected] start /home/al/python/template/ui
> webpack-dev-server --open

ℹ 「wds」: Project is running at http://localhost:8080/
ℹ 「wds」: webpack output is served from /
ℹ 「wds」: Content not from webpack is served from /home/al/python/template/ui
ℹ 「wds」: 404s will fallback to /index.html
ℹ 「wdm」: wait until bundle finished: /
✖ 「wdm」: Hash: 11349b9868bb6765819a
Version: webpack 4.43.0
Time: 1755ms
Built at: 10/03/2020 1:21:37 PM
     Asset       Size  Chunks             Chunk Names
index.html  831 bytes          [emitted]  
   main.js    396 KiB    main  [emitted]  main
Entrypoint main = main.js
[0] multi (webpack)-dev-server/client?http://localhost:8080 ./src 40 bytes {main} [built]
[./node_modules/ansi-html/index.js] 4.24 KiB {main} [built]
[./node_modules/ansi-regex/index.js] 139 bytes {main} [built]
[./node_modules/html-entities/lib/index.js] 449 bytes {main} [built]
[./node_modules/loglevel/lib/loglevel.js] 8.43 KiB {main} [built]
[./node_modules/strip-ansi/index.js] 161 bytes {main} [built]
[./node_modules/webpack-dev-server/client/index.js?http://localhost:8080] (webpack)-dev-server/client?http://localhost:8080 4.29 KiB {main} [built]
[./node_modules/webpack-dev-server/client/overlay.js] (webpack)-dev-server/client/overlay.js 3.51 KiB {main} [built]
[./node_modules/webpack-dev-server/client/socket.js] (webpack)-dev-server/client/socket.js 1.53 KiB {main} [built]
[./node_modules/webpack-dev-server/client/utils/createSocketUrl.js] (webpack)-dev-server/client/utils/createSocketUrl.js 2.91 KiB {main} [built]
[./node_modules/webpack-dev-server/client/utils/log.js] (webpack)-dev-server/client/utils/log.js 964 bytes {main} [built]
[./node_modules/webpack-dev-server/client/utils/reloadApp.js] (webpack)-dev-server/client/utils/reloadApp.js 1.59 KiB {main} [built]
[./node_modules/webpack-dev-server/client/utils/sendMessage.js] (webpack)-dev-server/client/utils/sendMessage.js 402 bytes {main} [built]
[./node_modules/webpack/hot sync ^\.\/log$] (webpack)/hot sync nonrecursive ^\.\/log$ 170 bytes {main} [built]
[./src/index.jsx] 834 bytes {main} [built] [failed] [1 error]
    + 18 hidden modules

ERROR in ./src/index.jsx
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: Unexpected token (13:4)

  11 | 
  12 | render(
> 13 |     <Provider store={store}>
     |     ^
  14 |         <App />
  15 |     </Provider>,
  16 |     document.getElementById('app')

Child html-webpack-plugin for "index.html":
     1 asset
    Entrypoint undefined = index.html
    [./node_modules/html-webpack-plugin/lib/loader.js!./src/index.html] 995 bytes {0} [built]
    [./node_modules/lodash/lodash.js] 528 KiB {0} [built]
    [./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 470 bytes {0} [built]
    [./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 500 bytes {0} [built]
ℹ 「wdm」: Failed to compile.

[```
What did I do wrong?
@wireless-road
Copy link
Author

After some research I created following .babelrc file:

$ cat .babelrc 
{
  "presets": [
    "react",
    "es2015"
  ]
}

After that I get following:

$ npm start

> [email protected] start /home/al/python/template/ui
> webpack-dev-server --open

ℹ 「wds」: Project is running at http://localhost:8080/
ℹ 「wds」: webpack output is served from /
ℹ 「wds」: Content not from webpack is served from /home/al/python/template/ui
ℹ 「wds」: 404s will fallback to /index.html
ℹ 「wdm」: wait until bundle finished: /
[BABEL] Note: The code generator has deoptimised the styling of "/home/al/python/template/ui/node_modules/react-dom/cjs/react-dom.development.js" as it exceeds the max of "500KB".
✖ 「wdm」: Hash: 3db8f8faee867891c547
Version: webpack 4.43.0
Time: 10950ms
Built at: 10/03/2020 1:32:43 PM
     Asset       Size  Chunks             Chunk Names
index.html  831 bytes          [emitted]  
   main.js   1.53 MiB    main  [emitted]  main
Entrypoint main = main.js
[0] multi (webpack)-dev-server/client?http://localhost:8080 ./src 40 bytes {main} [built]
[./node_modules/react-dom/index.js] 1.32 KiB {main} [built]
[./node_modules/react-redux/es/index.js] 789 bytes {main} [built]
[./node_modules/react/index.js] 189 bytes {main} [built]
[./node_modules/strip-ansi/index.js] 161 bytes {main} [built]
[./node_modules/webpack-dev-server/client/index.js?http://localhost:8080] (webpack)-dev-server/client?http://localhost:8080 4.29 KiB {main} [built]
[./node_modules/webpack-dev-server/client/overlay.js] (webpack)-dev-server/client/overlay.js 3.51 KiB {main} [built]
[./node_modules/webpack-dev-server/client/socket.js] (webpack)-dev-server/client/socket.js 1.53 KiB {main} [built]
[./node_modules/webpack-dev-server/client/utils/createSocketUrl.js] (webpack)-dev-server/client/utils/createSocketUrl.js 2.91 KiB {main} [built]
[./node_modules/webpack-dev-server/client/utils/log.js] (webpack)-dev-server/client/utils/log.js 964 bytes {main} [built]
[./node_modules/webpack-dev-server/client/utils/reloadApp.js] (webpack)-dev-server/client/utils/reloadApp.js 1.59 KiB {main} [built]
[./node_modules/webpack-dev-server/client/utils/sendMessage.js] (webpack)-dev-server/client/utils/sendMessage.js 402 bytes {main} [built]
[./node_modules/webpack/hot sync ^\.\/log$] (webpack)/hot sync nonrecursive ^\.\/log$ 170 bytes {main} [built]
[./src/App/index.js] 338 bytes {main} [built]
[./src/index.jsx] 600 bytes {main} [built]
    + 137 hidden modules

ERROR in ./src/_components/PrivateRoute.jsx
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: Unexpected token (4:53)

  2 | import { Route, Redirect } from 'react-router-dom';
  3 | 
> 4 | export const PrivateRoute = ({ component: Component, ...rest }) => (
    |                                                      ^
  5 |     <Route {...rest} render={props => (
  6 |         localStorage.getItem('user')
  7 |             ? <Component {...props} />

 @ ./src/_components/index.js 7:20-45
 @ ./src/App/App.jsx
 @ ./src/App/index.js
 @ ./src/index.jsx
Child html-webpack-plugin for "index.html":
     1 asset
    Entrypoint undefined = index.html
    [./node_modules/html-webpack-plugin/lib/loader.js!./src/index.html] 995 bytes {0} [built]
    [./node_modules/lodash/lodash.js] 528 KiB {0} [built]
    [./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 806 bytes {0} [built]
    [./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 521 bytes {0} [built]
ℹ 「wdm」: Failed to compile.

@wireless-road
Copy link
Author

Were able to run it under windows. Facing troubles under Ubuntu.

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

1 participant