Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial npm install problem, react-highlight.js depends on react version ^16.0.0 #16

Open
BuddhiLW opened this issue Oct 6, 2022 · 5 comments

Comments

@BuddhiLW
Copy link

BuddhiLW commented Oct 6, 2022

My solution was to put different versions of react requirement, on dev vs production:

  "dependencies": {
    "@smooth-ui/core-sc": "9.0.2",
    "create-react-class": "15.7.0",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "styled-components": "^4.1.2",
    "styled-icons": "^5.4.0"
  },
  "devDependencies": {
    "react": "^16.0.0",
    "react-dom": "^16.0.0",
    "react-flip-move": "^3.0.2",
    "react-highlight.js": "^1.0.7",
    "shadow-cljs": "2.20.2"
  }

Initial error:

npm install


npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR!   react@"17.0.2" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^0.14.0 || ^15.0.0 || ^16.0.0" from [email protected]
npm ERR! node_modules/react-highlight.js
npm ERR!   dev react-highlight.js@"^1.0.7" from the root project
@BuddhiLW
Copy link
Author

BuddhiLW commented Oct 6, 2022

Actually, I'm receiving another error...

Failed to inspect file
  /home/buddhilw/PP/ClojureScript/cheffy/cheffy/node_modules/react-highlight.js/node_modules/highlight.js/lib/languages/isbl.js

it was required from
  /home/buddhilw/PP/ClojureScript/cheffy/cheffy/node_modules/react-highlight.js/node_modules/highlight.js/lib/index.js

Errors encountered while trying to parse file
  /home/buddhilw/PP/ClojureScript/cheffy/cheffy/node_modules/react-highlight.js/node_modules/highlight.js/lib/languages/isbl.js
  {:line 1, :column 1, :message "The file could not be parsed as JavaScript."}

RuntimeException: Exception parsing "/home/buddhilw/PP/ClojureScript/cheffy/cheffy/node_modules/react-highlight.js/node_modules/highlight.js/lib/languages/isbl.js"
        com.google.javascript.jscomp.parsing.ParserRunner.parse (ParserRunner.java:148)
        com.google.javascript.jscomp.JsAst.parse (JsAst.java:157)
        com.google.javascript.jscomp.JsAst.getAstRoot (JsAst.java:63)
        shadow.build.closure.JsInspector.getFileInfo (JsInspector.java:180)
        shadow.build.closure.JsInspector.getFileInfoMap (JsInspector.java:194)
        shadow.build.npm/get-file-info*/fn--10725 (npm.clj:453)
        shadow.build.npm/get-file-info* (npm.clj:452)
        shadow.build.npm/get-file-info* (npm.clj:402)
        shadow.build.npm/get-file-info (npm.clj:513)
        shadow.build.npm/get-file-info (npm.clj:510)
        shadow.build.npm/find-resource-in-package (npm.clj:729)
        shadow.build.npm/find-resource-in-package (npm.clj:687)
        shadow.build.npm/find-resource (npm.clj:779)
        shadow.build.npm/find-resource (npm.clj:742)
        shadow.build.resolve/find-npm-resource (resolve.clj:122)
        shadow.build.resolve/find-npm-resource (resolve.clj:93)
        shadow.build.resolve/fn--12742 (resolve.clj:262)
        shadow.build.resolve/fn--12742 (resolve.clj:230)
        clojure.lang.MultiFn.invoke (MultiFn.java:244)
        shadow.build.resolve/find-resource-for-string (resolve.clj:80)
        shadow.build.resolve/find-resource-for-string (resolve.clj:69)
        shadow.build.resolve/resolve-string-require (resolve.clj:453)
        shadow.build.resolve/resolve-string-require (resolve.clj:436)
        shadow.build.resolve/resolve-require (resolve.clj:668)
        shadow.build.resolve/resolve-require (resolve.clj:661)
        shadow.build.resolve/resolve-deps/fn--12693 (resolve.clj:51)
        clojure.lang.PersistentVector.reduce (PersistentVector.java:343)
        clojure.core/reduce (core.clj:6885)
        clojure.core/reduce (core.clj:6868)
        shadow.cljs.util/reduce-> (util.clj:42)
        shadow.cljs.util/reduce-> (util.clj:41)
        shadow.build.resolve/resolve-deps (resolve.clj:49)
        shadow.build.resolve/resolve-deps (resolve.clj:33)
        shadow.build.resolve/resolve-string-require (resolve.clj:478)
        shadow.build.resolve/resolve-string-require (resolve.clj:436)
        shadow.build.resolve/resolve-require (resolve.clj:668)
        shadow.build.resolve/resolve-require (resolve.clj:661)
        shadow.build.resolve/resolve-deps/fn--12693 (resolve.clj:51)
        clojure.lang.PersistentVector.reduce (PersistentVector.java:343)
        clojure.core/reduce (core.clj:6885)
        clojure.core/reduce (core.clj:6868)
        shadow.cljs.util/reduce-> (util.clj:42)
        shadow.cljs.util/reduce-> (util.clj:41)
        shadow.build.resolve/resolve-deps (resolve.clj:49)
        shadow.build.resolve/resolve-deps (resolve.clj:33)
        shadow.build.resolve/resolve-string-require (resolve.clj:478)
        shadow.build.resolve/resolve-string-require (resolve.clj:436)
        shadow.build.resolve/resolve-require (resolve.clj:668)
        shadow.build.resolve/resolve-require (resolve.clj:661)
        shadow.build.resolve/resolve-deps/fn--12693 (resolve.clj:51)
        clojure.lang.PersistentVector.reduce (PersistentVector.java:343)
        clojure.core/reduce (core.clj:6885)
        clojure.core/reduce (core.clj:6868)
        shadow.cljs.util/reduce-> (util.clj:42)
        shadow.cljs.util/reduce-> (util.clj:41)
        shadow.build.resolve/resolve-deps (resolve.clj:49)
        shadow.build.resolve/resolve-deps (resolve.clj:33)
        shadow.build.resolve/resolve-symbol-require (resolve.clj:655)
        shadow.build.resolve/resolve-symbol-require (resolve.clj:615)
        shadow.build.resolve/resolve-require (resolve.clj:665)
        shadow.build.resolve/resolve-require (resolve.clj:661)
        shadow.build.resolve/resolve-deps/fn--12693 (resolve.clj:51)
        clojure.lang.PersistentVector.reduce (PersistentVector.java:343)
        clojure.core/reduce (core.clj:6885)
        clojure.core/reduce (core.clj:6868)
        shadow.cljs.util/reduce-> (util.clj:42)
        shadow.cljs.util/reduce-> (util.clj:41)
        shadow.build.resolve/resolve-deps (resolve.clj:49)
        shadow.build.resolve/resolve-deps (resolve.clj:33)
        shadow.build.resolve/resolve-symbol-require (resolve.clj:655)
        shadow.build.resolve/resolve-symbol-require (resolve.clj:615)
        shadow.build.resolve/resolve-require (resolve.clj:665)
        shadow.build.resolve/resolve-require (resolve.clj:661)
        shadow.build.resolve/resolve-deps/fn--12693 (resolve.clj:51)
        clojure.lang.PersistentVector.reduce (PersistentVector.java:343)
        clojure.core/reduce (core.clj:6885)
        clojure.core/reduce (core.clj:6868)
        shadow.cljs.util/reduce-> (util.clj:42)
        shadow.cljs.util/reduce-> (util.clj:41)
        shadow.build.resolve/resolve-deps (resolve.clj:49)
Caused by:
StackOverflowError: 
        com.google.javascript.jscomp.parsing.IRFactory$TransformDispatcher.processBinaryExpression (IRFactory.java:1795)
        com.google.javascript.jscomp.parsing.IRFactory$TransformDispatcher.process (IRFactory.java:2848)
        com.google.javascript.jscomp.parsing.IRFactory.transform (IRFactory.java:787)
        com.google.javascript.jscomp.parsing.IRFactory$TransformDispatcher.processBinaryExpression (IRFactory.java:1800)
        com.google.javascript.jscomp.parsing.IRFactory$TransformDispatcher.process (IRFactory.java:2848)
        com.google.javascript.jscomp.parsing.IRFactory.transform (IRFactory.java:787)

@bherrmann7
Copy link

Boo. I'm getting the same issue!

@jacekschae
Copy link
Owner

Let me take a look

@jacekschae
Copy link
Owner

Please install with npm install --legacy-peer-deps. I assume you are installing from /cheffy folder i also tried with /completed and it all works.

You will have to change core to dom in reagent as they changed api in verison 1.0.

(:require [reagent.core :as r])

to

(:require [reagent.dom :as r])

@bherrmann7
Copy link

bherrmann7 commented Oct 31, 2023

Hummm... I did "npm install --legacy-peer-deps" like you suggested, it completed successfully.

Then I ran "npm run dev" and the application displayed "Cheffy", exactly as it is supposed to.

I did not change the require. (yet anyway.)

THANKS!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants