HumanSignal / label-studio-frontend

Data labeling react app that is backend agnostic and can be embedded into your applications — distributed as an NPM package
https://labelstud.io/
Apache License 2.0
421 stars 316 forks source link

Cannot install dependencies using 'npm install' #1264

Open costika1234 opened 1 year ago

costika1234 commented 1 year ago

Running npm install on macOS 12.6.3 fails with the following error message:

$ npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: @heartexlabs/label-studio@1.4.0
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR!   dev react@"^17.0.2" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.0 || 16.9.0-alpha.0" from mobx-react@6.3.1
npm ERR! node_modules/mobx-react
npm ERR!   dev mobx-react@"^6" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! 
npm ERR! For a full report see:
npm ERR! /Users/.../.npm/_logs/2023-03-21T12_40_22_291Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/.../.npm/_logs/2023-03-21T12_40_22_291Z-debug-0.log

Does anyone know how to fix this?

epeters3 commented 1 year ago

I was able to get the app to run locally using yarn install and yarn start (yarn v1.22). Yarn v1 is less strict about dependency version conflicts than npm is.

costika1234 commented 1 year ago

I was able to get the app to run locally using yarn install and yarn start (yarn v1.22). Yarn v1 is less strict about dependency version conflicts than npm is.

Using the above has destroyed the iCloud sync on my desktop machine, so now I'm faced with an issue that is incredibly hard to solve given iCloud's poor reliability. Also, I was not asking about running the app. I just want to generate the JS and CSS files of the Label Studio front-end, which seems impossible given the current state of things. I don't understand why this library exists if 1) it is poorly documented; 2) nobody wants to release a new version; 3) a new build can't be triggered. I'm sorry, but I'm utterly disgusted.

epeters3 commented 1 year ago

I just want to generate the JS and CSS files of the Label Studio front-end

@costika1234 I believe you can just install the package to get the built js and css files, e.g.:

>>> npm install @heartexlabs/label-studio
...
>>> ls -R node_modules/@heartexlabs/label-studio/build/
node_modules/@heartexlabs/label-studio/build/:
index.html  static

node_modules/@heartexlabs/label-studio/build/static:
css  js

node_modules/@heartexlabs/label-studio/build/static/css:
main.css  main.css.map

node_modules/@heartexlabs/label-studio/build/static/js:
main.js  main.js.LICENSE.txt  main.js.map

Using the above has destroyed the iCloud sync on my desktop machine

If you run yarn install or npm install inside of a cloud-synced folder, I believe by default it will try to sync the many files inside the resulting node_modules folder, which can cause issues. Maybe if you delete the directory you were in both locally and in iCloud it will get you back to a good state?

costika1234 commented 1 year ago

The issues I have to deal with are incredibly painful. I don't think I want to run any commands at the minute given how screwed up my machine is. iCloud is also another PITA and it can't be fixed easily. This happened to me a few years ago and the only reliable fix involves moving the files on a separate hard drive, deleting everything, and then putting the files back to their original locations. It's going to take days until the sync is complete because iCloud is really the worst cloud solution out there.

costika1234 commented 1 year ago

The command that finally worked on my Mac was

yarn add @heartexlabs/label-studio

Please document this in the README along with a warning that users should not attempt to build the library in a cloud-synced folder.

mwalmsley commented 11 months ago

This remains broken.

The yarn 'skip' message helpfully lists the incompatible versions:

warning "@wojtekmaj/enzyme-adapter-react-17 > enzyme-adapter-utils@1.14.0" has incorrect peer dependency "react@0.13.x || 0.14.x || ^15.0.0-0 || ^16.0.0-0".
warning "@wojtekmaj/enzyme-adapter-react-17 > enzyme-adapter-utils > airbnb-prop-types@2.16.0" has incorrect peer dependency "react@^0.14 || ^15.0.0 || ^16.0.0-alpha".
warning " > mobx-react@6.3.1" has incorrect peer dependency "react@^16.8.0 || 16.9.0-alpha.0".
warning "mobx-react > mobx-react-lite@2.2.2" has incorrect peer dependency "react@^16.8.0".
warning " > react-test-renderer@18.2.0" has incorrect peer dependency "react@^18.2.0".

These incompatible react versions cause npm to fail.

Yarn will ignore this conflict, and these versions do seem to work together nonetheless - but it would be a very helpful fix if a dev could specify the intended versions. I think many people will be frustrated that npm fails.