I'm developing project in React (type script). I wanted to add new feature for export/import excel files and I decided to use xlsx library https://www.npmjs.com/package/xlsx So my issue is that I ran "yarn add xlsx" and my app is giving me error "Uncaught SyntaxError: Unexpected token '<' |". I didn't do any imports just yarn add xlsx and I've got this error. [![enter image description here][1]][1] Compilation is successful no other errors.
What's strange is that I found out when I'll do this hack in my project:
npm install xlsx
yarn install
then everything is working just fine. I tried on different computers yarn add xlsx in the same project and everywhere it was not working... But then I decided to implement some basic functionality using xlsx added by npm locally and deployed my project on linux docker without "npm install xlsx" and it's working there!
Maybe something wrong with the file system or fs library?
EDIT: NEW INFORMATION It turns out that when I will do such scenario
- yarn install
- yarn add xlsx
everything works
but if I'll do
- yarn install
- yarn add xlsx
- yarn install
error appears!
So after running yarn install some dependencies are installed and that's why it's failing It's not good because when I'll commit my changes then other developers will install dependencies using "yarn install"