Search code examples
reactjsbabeljsnetlifyprettier

Error with prettier in ReactJS app: Expected atom at position 0


I am trying to deploy my ReactJS app (note: branch is custom_section_formatter) on Netlify. Previously everything worked fine, but today after making some changes I keep getting this error:

4:54:51 PM: ./node_modules/prettier/standalone.js

4:54:51 PM: SyntaxError: /opt/build/repo/apps/live-paper-builder/node_modules/prettier/standalone.js: Expected atom at position 0

4:54:51 PM: {{(.+?)}}

4:54:51 PM: ^

4:54:51 PM: error Command failed with exit code 1.

From everything I have searched on the web, it seems to be related to a BabelJS issue, but that apparently has been resolved. So not sure why I still get this error. My build logs are here. I am obviously doing something wrong, but not sure what.


Solution

  • This problem can be fixed by using an older version of the 'prettier' package. Specifically

    "prettier": "<=2.3.0",
    

    in the 'dependencies' section of your package.json file

    Found a related query here and its related PR, which helped resolve this.