react-webpack-generators / generator-react-webpack

Yeoman generator for ReactJS and Webpack
http://newtriks.com/2013/12/31/automating-react-with-yeoman-and-grunt/
MIT License
2.88k stars 355 forks source link

when i use "npm run serve",the following error occurs,but "npm run serve:dist" is ok. #229

Closed galaa2011 closed 8 years ago

galaa2011 commented 8 years ago

The following error occurs when I start the server after initial install: http://localhost:8000/assets/app.js 404 (Not Found)

ERROR in ./src/index.js
Module parse failed: d:\works\ad-fe\react-webpack\src\index.js Unexpected token
(7:16)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (7:16)
    at Parser.pp.raise (D:\works\ad-fe\react-webpack\node_modules\acorn\dist\aco
rn.js:920:13)
    at Parser.pp.unexpected (D:\works\ad-fe\react-webpack\node_modules\acorn\dis
t\acorn.js:1483:8)
    at Parser.pp.parseExprAtom (D:\works\ad-fe\react-webpack\node_modules\acorn\
dist\acorn.js:330:12)
    at Parser.pp.parseExprSubscripts (D:\works\ad-fe\react-webpack\node_modules\
acorn\dist\acorn.js:225:19)
    at Parser.pp.parseMaybeUnary (D:\works\ad-fe\react-webpack\node_modules\acor
n\dist\acorn.js:204:17)
    at Parser.pp.parseExprOps (D:\works\ad-fe\react-webpack\node_modules\acorn\d
ist\acorn.js:151:19)
    at Parser.pp.parseMaybeConditional (D:\works\ad-fe\react-webpack\node_module
s\acorn\dist\acorn.js:133:19)
    at Parser.pp.parseMaybeAssign (D:\works\ad-fe\react-webpack\node_modules\aco
rn\dist\acorn.js:110:19)
    at Parser.pp.parseExprList (D:\works\ad-fe\react-webpack\node_modules\acorn\
dist\acorn.js:657:23)
    at Parser.pp.parseSubscripts (D:\works\ad-fe\react-webpack\node_modules\acor
n\dist\acorn.js:249:29)
 @ multi main
webpack: bundle is now VALID.
galaa2011 commented 8 years ago

Wait on line

weblogixx commented 8 years ago

Hi @galaa2011,

could you give some more information like (OS, Node-Version etc?). Could you also please provide a link to the repository that fails?

galaa2011 commented 8 years ago

Hi @weblogixx , OS: win7 32bit\Node: v6.2.0 And i pushed my project to github.The link to repository: https://github.com/galaa2011/react-webpack.git

weblogixx commented 8 years ago

Thanks, I will have a look at it and report back.

weblogixx commented 8 years ago

Just tried it with node 4, 5 and 6.2, it starts correctly with every system for me. Did you do any special stuff before starting (e.g. installing with v5, then installing v6) or something like that?

What happens when you run npm install again? Maybe one of the project dependencies was not installed correctly (or at all)? We had such a problem with some guys that where behind the great (fire)wall of china...

Currently just from the project logic it seems all good to me. Sorry I could not help further.

galaa2011 commented 8 years ago

I don't know the reason,but i solve it by installing node4.4.5. Thanks a lot for your help !

weblogixx commented 8 years ago

Strange issue, but thanks for your feedback anyways :).

pjnovas commented 7 years ago

This issue is not fixed, it's happening to me right now, I have node 6.3.1 in win 8.1. It's sooo weird but I tried moving to node v4.5.0 and it works, so this must be something with Windows + NodeJS 6+

Idk how to tackle this really

lpillmann commented 7 years ago

This also happened to me, but I figured out the cause: an error in importing a CSS file I had deleted. Apparently this seems to be a symptom for when "something" is not right with your code.

@pjnovas I would suggest you to double check the server console/terminal for potential errors it might be printing out.

I'm running NodeJS 6.9.1 on macOS Sierra.

pjnovas commented 7 years ago

@luipillmann mmh could be but I'm using a generator in which after initial creation throws the error on that setup but didn't failed on the second setup. will be hard to check what could be cause I didn't find anything on the terminal.

I'll try when I get some time.