Search code examples
reactjscreate-react-app

Unexpected character ' ' (1:0) in node_modules\create-react-context\lib\index.js


This keeps happening in create-react-app every time I add a package using yarn.

./node_modules/create-react-context/lib/index.js
SyntaxError: d:\project\client\node_modules\create-react-context\lib\index.js: Unexpected character ' ' (1:0)

> 1 |
    | ^

I have to copy this https://github.com/jamiebuilds/create-react-context/blob/master/src/index.js and paste it to node_modules\create-react-context\lib\index.js every time to get rid off that error.

I'm using VSCodium as my editor. How can I get rid off this error permanently?


Solution

  • I haven't found a permanent solution to this problem. I had to stop working on that project for some reason and since then I didn't face this problem in any other project. In the future if anyone stumbles upon this error this is the temporary solution.

    Copy the contents of this file https://github.com/jamiebuilds/create-react-context/blob/master/src/index.js to node_modules\create-react-context\lib\index.js.