react-hot-redux-firebase-starter icon indicating copy to clipboard operation
react-hot-redux-firebase-starter copied to clipboard

Unexpected Token

Open mfs780 opened this issue 7 years ago • 5 comments

I get the following error when running npm start ERROR in ./src/index.js
Module parse failed: src\index.js Unexpected token (43:8)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (43:8)
at Parser.pp$4.raise (\node_modules\webpack\node_modules\acorn\dist\acorn.js:2221:15)
at Parser.pp.unexpected (\node_modules\webpack\node_modules\acorn\dist\acorn.js:603:10)
at Parser.pp$3.parseExprAtom (\node_modules\webpack\node_modules\acorn\dist\acorn.js:1822:12)
at Parser.pp$3.parseExprSubscripts (\node_modules\webpack\node_modules\acorn\dist\acorn.js:1715:21)
at Parser.pp$3.parseMaybeUnary (\node_modules\webpack\node_modules\acorn\dist\acorn.js:1692:19)
at Parser.pp$3.parseExprOps (\node_modules\webpack\node_modules\acorn\dist\acorn.js:1637:21)
at Parser.pp$3.parseMaybeConditional (\node_modules\webpack\node_modules\acorn\dist\acorn.js:1620:21)
at Parser.pp$3.parseMaybeAssign (\node_modules\webpack\node_modules\acorn\dist\acorn.js:1597:21)
at Parser.pp$3.parseExprList (\node_modules\webpack\node_modules\acorn\dist\acorn.js:2165:22)
at Parser.pp$3.parseSubscripts (\node_modules\webpack\node_modules\acorn\dist\acorn.js:1741:35)
@ multi main

mfs780 avatar Sep 15 '16 05:09 mfs780

@mfs780 did you run npm install first? It seems that it is not recognizing the JSX on index.js, which probably means that the react library is not in your project, which should get set by npm install

douglascorrea avatar Sep 15 '16 20:09 douglascorrea

@douglascorrea So I did a npm install and was still getting the issue. I decided to download the git repo in a fresh directly and follow the npm install and then npm start -s steps again. This time it runs but gives the following error.

ERROR in ./src/api/firebase.js Module not found: Error: Cannot resolve module 'firebase/firebase-browser' in \react-hot-redux-firebase-starter-master\src\api @ ./src/api/firebase.js 9:23-59

The website opens up to localhost:3000 to a blank screen. The console shows the following error Uncaught Error: Cannot find module "firebase/firebase-browser"

mfs780 avatar Sep 16 '16 06:09 mfs780

I was able to fix the issue by changing the following in /src/api/firebase.js

import * as firebase from 'firebase/firebase-browser'; to import * as firebase from 'firebase';

mfs780 avatar Sep 16 '16 06:09 mfs780

@mfs780 thanks for the investigation

With your input I found the problem. Firebase recently changed their API removing browser (https://firebase.google.com/support/release-notes/js#wzxhzdk16version_310_-_june_28_2016wzxhzdk17) specific api.

As the package.json has ^3.0.3 version for Firebase, any updates below v4 will be used which should not break apis, but Firebase do not follow that.

So I need to update the code as you suggested.

But I also need to make a cleanup on everything. So will do it as soon I get the entire cleanup done, or, if you wanna help, fell fee to submit a PR.

:)

douglascorrea avatar Sep 16 '16 06:09 douglascorrea

Actually I just found the source of the initial problem. If I am running Visual Studio Code at the time I run npm start it causes the above mentioned error with index.js.

mfs780 avatar Sep 16 '16 06:09 mfs780