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

Can't resolve 'highlight.js/lib/languages/node-repl' #343

Closed
tu4mo opened this issue Dec 8, 2020 · 5 comments · Fixed by #344 or #345
Closed

Can't resolve 'highlight.js/lib/languages/node-repl' #343

tu4mo opened this issue Dec 8, 2020 · 5 comments · Fixed by #344 or #345

Comments

@tu4mo
Copy link
Contributor

tu4mo commented Dec 8, 2020

Describe the bug

Can't resolve 'highlight.js/lib/languages/node-repl' in '/*/node_modules/react-syntax-highlighter/dist/esm/async-languages'

To Reproduce
Have react-syntax-highlighter installed with other package that depends on a version of highlight.js that's fixed to <10.4.0.

Expected behavior
react-syntax-highlighter depends on highlight.js@^10.4.0 (instead of ^10.1.1) where node-repl was added.

@aurelien-reeves
Copy link
Contributor

aurelien-reeves commented Dec 8, 2020

In my yarn.lock file, lowlight@^1.14.0 is resolved to 1.16.0
Even if I add lowlight@^1.17.0, I still have the 1.16.0 installed, wich then add highlight.js@10.3.0

lowlight@^1.14.0:
  version "1.16.0"
  resolved "https://registry.yarnpkg.com/lowlight/-/lowlight-1.16.0.tgz#9d904370d0b20bca0893d73559cf27428fecbf7e"
  integrity sha512-ECLdzIJvBEjK4ef51sWiGZyz21yx4IEPaF/62DRxLehoOHkWqN3OsLB1GUMfc6Mcf87rR5eW7z6lI9cNEXZDsQ==
  dependencies:
    fault "^1.0.0"
    highlight.js "~10.3.0"

lowlight@^1.17.0:
  version "1.17.0"
  resolved "https://registry.yarnpkg.com/lowlight/-/lowlight-1.17.0.tgz#a1143b2fba8239df8cd5893f9fe97aaf8465af4a"
  integrity sha512-vmtBgYKD+QVNy7tIa7ulz5d//Il9R4MooOVh4nkOf9R9Cb/Dk5TXMSTieg/vDulkBkIWj59/BIlyFQxT9X1oAQ==
  dependencies:
    fault "^1.0.0"
    highlight.js "~10.4.0"

I don't understand why lowlight@^1.14.0 resolve in 1.16 instead of 1.17.

yarn why lowlight
yarn why v1.22.4
[1/4] Why do we have the module "lowlight"...?
[2/4] Initialising dependency graph...
[3/4] Finding dependency...
[4/4] Calculating file sizes...
=> Found "lowlight@1.17.0"
info Has been hoisted to "lowlight"
info This module exists because it's specified in "dependencies".
info Disk size without dependencies: "2.62MB"
info Disk size with unique dependencies: "5.09MB"
info Disk size with transitive dependencies: "5.12MB"
info Number of shared dependencies: 2
=> Found "react-syntax-highlighter#lowlight@1.16.0"
info This module exists because "react-syntax-highlighter" depends on it.
info Disk size without dependencies: "48KB"
info Disk size with unique dependencies: "2.51MB"
info Disk size with transitive dependencies: "2.54MB"
info Number of shared dependencies: 2
Done in 1.37s.

@aurelien-reeves
Copy link
Contributor

It seems I found a way to make it work:

I have removed lowlight and react-syntax-highlighter from the dependencies in package.json, then executed yarn install. It seems to have "cleaned-up" the yarn.lock file.

I have also clean the cache of yarn (yarn cache clean lowlight and yarn cache clean react-syntax-highlighter). I don't know if that was actually usefull.

Then yarn add react-syntax-highlighter and yarn install again. The yarn.lock file now have only lowlight@1.17.0, and my build has passed.

@andrevenancio
Copy link

Having the same issue on a next.js project that uses this module as a dependency. I had to do something similar but using npm myself.

So rm -rf node_modules package-lock.json .next and then npm install and was able to build my next.js application after that.

@tu4mo
Copy link
Contributor Author

tu4mo commented Dec 9, 2020

I'm still getting the same error. You need to bump highlight.js also.

@aurelien-reeves
Copy link
Contributor

Indeed I missed that! I assumed it was actually the case following the PR wich bump highlight.js to v10.4.1: #338

But actually, it just updated package-lock.json. Not package.json.

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