question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unexpected token (7:2) You may need an appropriate loader to handle this file type.

See original GitHub issue

Ran create-react-app react-my-create-react-app-created followed by npm start with this error result:

Error in d:/src/react-my-create-react-app-created/src/index.js
Module parse failed: d:\src\react-my-create-react-app-created\src\index.js Unexpected token (7:2)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (7:2)

and here’s the devtools console output:

[HMR] Waiting for update signal from WDS...
webpack:///multi_main?:4 Uncaught Error: Cannot find module "c:\Users\guivh\src\react-my-create-react-app-created\src\index"
client:23 [WDS] Hot Module Replacement enabled.
client:46 [WDS] Errors while compiling.
client:48 d:/src/react-my-create-react-app-created/src/index.js
Module parse failed: d:\src\react-my-create-react-app-created\src\index.js Unexpected token (7:2)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (7:2)
    at Parser.pp$4.raise (D:\src\react-my-create-react-app-created\node_modules\react-scripts\node_modules\acorn\dist\acorn.js:2221:15)
    at Parser.pp.unexpected (D:\src\react-my-create-react-app-created\node_modules\react-scripts\node_modules\acorn\dist\acorn.js:603:10)
    at Parser.pp$3.parseExprAtom (D:\src\react-my-create-react-app-created\node_modules\react-scripts\node_modules\acorn\dist\acorn.js:1822:12)
    at Parser.pp$3.parseExprSubscripts (D:\src\react-my-create-react-app-created\node_modules\react-scripts\node_modules\acorn\dist\acorn.js:1715:21)
    at Parser.pp$3.parseMaybeUnary (D:\src\react-my-create-react-app-created\node_modules\react-scripts\node_modules\acorn\dist\acorn.js:1692:19)
    at Parser.pp$3.parseExprOps (D:\src\react-my-create-react-app-created\node_modules\react-scripts\node_modules\acorn\dist\acorn.js:1637:21)
    at Parser.pp$3.parseMaybeConditional (D:\src\react-my-create-react-app-created\node_modules\react-scripts\node_modules\acorn\dist\acorn.js:1620:21)
    at Parser.pp$3.parseMaybeAssign (D:\src\react-my-create-react-app-created\node_modules\react-scripts\node_modules\acorn\dist\acorn.js:1597:21)
    at Parser.pp$3.parseExprList (D:\src\react-my-create-react-app-created\node_modules\react-scripts\node_modules\acorn\dist\acorn.js:2165:22)
    at Parser.pp$3.parseSubscripts (D:\src\react-my-create-react-app-created\node_modules\react-scripts\node_modules\acorn\dist\acorn.js:1741:35)
    at Parser.pp$3.parseExprSubscripts (D:\src\react-my-create-react-app-created\node_modules\react-scripts\node_modules\acorn\dist\acorn.js:1718:17)
    at Parser.pp$3.parseMaybeUnary (D:\src\react-my-create-react-app-created\node_modules\react-scripts\node_modules\acorn\dist\acorn.js:1692:19)
    at Parser.pp$3.parseExprOps (D:\src\react-my-create-react-app-created\node_modules\react-scripts\node_modules\acorn\dist\acorn.js:1637:21)
    at Parser.pp$3.parseMaybeConditional (D:\src\react-my-create-react-app-created\node_modules\react-scripts\node_modules\acorn\dist\acorn.js:1620:21)
    at Parser.pp$3.parseMaybeAssign (D:\src\react-my-create-react-app-created\node_modules\react-scripts\node_modules\acorn\dist\acorn.js:1597:21)
    at Parser.pp$3.parseExpression (D:\src\react-my-create-react-app-created\node_modules\react-scripts\node_modules\acorn\dist\acorn.js:1573:21)
 @ multi main

npm version is 3.10.4 node version ia v6.3.1

Please advise

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:20 (9 by maintainers)

github_iconTop GitHub Comments

16reactions
jturbo26commented, Jan 26, 2017

I had this error and it was because I created my components folder outside the src folder. Once I moved it inside src everything worked fine.

I just wanted to drop my amateur mistake and solution here just in case someone comes across it in the future.

7reactions
leshowcommented, Feb 27, 2017

@jturbo26 What if you are importing a component that lives in a separate dir outside of src? Say in the case when you have more than one app sharing a component? I’m running into this error and there is no real solution, I don’t want to bring the component into src because it’s supposed to exist separately.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Module parse failed: Unexpected Token. You may need an ...
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file." 0 · React...
Read more >
Module parse failed: Unexpected token. You may ... - GitHub
Module parse failed: Unexpected token. You may need an appropriate loader to handle this file type, currently no loaders are configured to process...
Read more >
You may need an appropriate loader to handle ... - Laracasts
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. ; Laracasts Master....
Read more >
module parse failed: unexpected token (1:0) you may need an ...
Answer. The root cause is that your Typescript rule isn't matching (“currently no loaders are configured to process this file”), so Webpack is...
Read more >
039;t build with webpack - Material Design for Bootstrap
css 6:3 Module parse failed: Unexpected token (6:3) You may need an appropriate loader to handle this file type, currently no loaders are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found