vouch-opensource / krell

Simple ClojureScript React Native Tooling
Eclipse Public License 1.0
673 stars 37 forks source link

trouble installing repl dependencies with npm 7 #121

Closed apostolou closed 3 years ago

apostolou commented 3 years ago

Thank you for this great contribution.

I've followed the instructions under the wiki and installed the whole RN environment following these instructions.

My dependencies in package.json file are:

"dependencies": {
    "react": "17.0.1",
    "react-native": "0.64.0"
  },

Note that when I run npm install or npx react-native run-ios everything works well.

Now, when running the command to install repl dependencies :

clj -m cljs.main --install-deps

I've got the following error :

AwesomeProject $clj -m cljs.main --install-deps
WARNING: When invoking clojure.main, use -M
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: AwesomeProject@0.0.1
npm ERR! Found: react@16.13.0
npm ERR! node_modules/react
npm ERR!   react@"16.13.0" from the root project
npm ERR!   peer react@"^16.8" from @react-native-community/async-storage@1.10.0
npm ERR!   node_modules/@react-native-community/async-storage
npm ERR!     @react-native-community/async-storage@"1.10.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"17.0.1" from react-native@0.64.0
npm ERR! node_modules/react-native
npm ERR!   react-native@"0.64.0" from the root project
npm ERR!   peer react-native@">=0.59" from @react-native-community/async-storage@1.10.0
npm ERR!   node_modules/@react-native-community/async-storage
npm ERR!     @react-native-community/async-storage@"1.10.0" 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.

The only way I found to fix this was to downgrade my npm to v6 : npm install -g npm@6.14.12. When I did this, the install deps step finished correctly, but my package.json dependencies changed to

"dependencies": {
    "@cljs-oss/module-deps": "^1.1.1",
    "@react-native-community/async-storage": "^1.10.0",
    "react": "^16.13.0",
    "react-dom": "^16.13.0", 
    "react-native": "0.64.0",
    "react-native-tcp-socket": "^4.5.1"
  }

=> note here the downgrade of version in react.

Am I missing something in the dependencies configuration ? Is krell supposed to work only with npm 6 ? How can I force the use of react 17.0.1 version , or how can I do if I want to use in my project a dependency on @react-native-community/async-storage": "1.12.1"

Thx

hkjels commented 3 years ago

I'm getting the same error

hkjels commented 3 years ago

I got everything running here now. The issues I was experiencing was due to the architecture of my new M1 Mac. The solution that worked for me was to exclude arm64 from the project and pods, set minimum iOS version to 10 for all pods and:

sudo arch x86_64 gem install cocoapods
arch x86_64 pod install
arch x86_64 npm run ios
apostolou commented 3 years ago

@swannodette , I can still reproduce the npm errors reported @ 92115e1f271259e21e67881dd94c2b668e4143d8 when using NPM 7 (7.11.1). When downgrading to NPM 6 (6.14.13) everything works fine. In the readme, it is mentioned to use yarn if we have an error message. This works, but should we update the doc in that case to always use yarn ? Thx

swannodette commented 3 years ago

@apostolou async storage is no longer there so the error can't be the same. It's possible to make npm work if you aware of what to do.

apostolou commented 3 years ago

thx for reply. I'm using async-storage in my project so I have a dep on it. I'm planning to migrate from it at one point (as it is no longer supported). I'm fine with using yarn anyways 👍