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

北战南征 提交于 2021-01-29 09:23:22

问题


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?


回答1:


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 future if anyone stumbles upon this error this is the temporary solution for you.

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.



来源:https://stackoverflow.com/questions/55673948/unexpected-character-10-in-node-modules-create-react-context-lib-index-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!