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

Getting browserify error - Unexpected token (4:13) while parsing file: index.jsx #44

Open
explorer2309 opened this issue Dec 8, 2015 · 7 comments

Comments

@explorer2309
Copy link

After generating the project and running npm start, I ran into this error

[06:33:12] Browserify Error { [SyntaxError: C:/projects/react/gen-flux-demo/src/js/index.jsx: Unexpected token (4:13) while parsing file: C:\projects\react\gen-flux-demo\src\js\index.jsx]
  pos: 99,
  loc: Position { line: 4, column: 13 },
  _babel: true,
  codeFrame: '\u001b[0m  2 | \u001b[36mimport\u001b[39m AppContainer from \u001b[31m\'./components/AppContainer.jsx\'\u001b[39m\u001b[1m;\u001b[22m\n  3 | \n> 4 | React\u001b[1m.\u001b[22mrender\u001b[94m\u001b[1m(\u001b[22m\u001b[39m\u001b[1m<\u001b[22mAppContainer \u001b[1m/\u001b[22m\u001b[1m>\u001b[22m\u001b[1m,\u001b[22m document\u001b[1m.\u001b[22mgetElementById\u001b[94m\u001b[1m(\u001b[22m\u001b[39m\u001b[31m\'main\'\u001b[39m\u001b[94m\u001b[1m)\u001b[22m\u001b[39m\u001b[94m\u001b[1m)\u001b[22m\u001b[39m\u001b[1m;\u001b[22m\n    |              ^\n  5 | \u001b[0m',
  filename: 'C:\\projects\\react\\gen-flux-demo\\src\\js\\index.jsx',

I am getting same error on Linux as well

Any ideas?

@loulafripouille
Copy link

Hello,
Firstly, thanks for this really good generator!

So, I have the same issue when I try to install the npm package superagent. It is the normal behavior?

Kind regards.

@christopherslee
Copy link

i get the same issue on OS X.

@christopherslee
Copy link

i was able to follow some instructions here: babel/babelify#126

npm install --save-dev babel-preset-es2015
npm install --save-dev babel-preset-react

then edit .babelrc

{
  "presets": ["es2015", "react"]
}

@madebysquares
Copy link

👍 this worked for me thanks @christopherslee

@BrunoQuaresma
Copy link

Works for me too. Thanks @christopherslee

@banderson
Copy link
Owner

Thanks @christopherslee and friends! I just published 0.4.6 which should include this change. Let me know if you run into any issues.

@klvenky
Copy link

klvenky commented Apr 23, 2017

Hi all,
I have come across this when I was trying to do something on react with es6. Even I followed the same babel config

{
  "presets": [
    [
      "es2015"
    ],
    "react"
  ],
  "plugins": [
    "react-hot-loader/babel"
  ]
}

However though It didn't work for me. It shows that there is an unexpected token which I found out to be "="

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

7 participants