HylianComrade
HylianComrade10mo ago

How to override the version from a dependency of a project's dependency from npm

I'm currently using react-pdf as a dependency, react-pdf uses fontkit as a dependency, and fontkit uses the npm restructure library. restructure, on the other hand, broke fontkit, therefore I would like to replace the new restructure version with the old one, so I tried using Deno.json's imports map, and scopes as well.
"imports": {
"restructure": "npm:restructure@3.0.0"
}
"imports": {
"restructure": "npm:restructure@3.0.0"
}
"scopes": {
"fontkit@2.0.2": {
"restructure": "npm:restructure@3.0.0"
}
}
"scopes": {
"fontkit@2.0.2": {
"restructure": "npm:restructure@3.0.0"
}
}
None of them replaced the version. Given that, there's a way to do so?
7 Replies
Leokuma
Leokuma10mo ago
I think your first attempt, without scopes, should work Delete your node_modules folder and deno.lock file and try to run your project again with that import
HylianComrade
HylianComradeOP10mo ago
there's no node_modules folder, and I deleted deno.lock file already
Leokuma
Leokuma10mo ago
try adding the following to your deno.json so that it creates a node_modules folder: "vendor": true
HylianComrade
HylianComradeOP10mo ago
Hello @Leokuma , first, thanks for the help, unfortunately, I had no success, it has creatednode_modules, and vendor folders, but the problem persists, I also deleted deno.lock again. Follow an image of the recently generated deno.lock showing restructure on its latest version.
No description
HylianComrade
HylianComradeOP10mo ago
also on node_modules there's a folder with the lastet version 3.0.1 instead 3.0.0
HylianComrade
HylianComradeOP10mo ago
No description
Leokuma
Leokuma10mo ago
Ok so I guess you can report your issue here: https://github.com/denoland/deno/issues/20868
GitHub
npm: specifiers ignore import map · Issue #20868 · denoland/deno
I'm running into a bug with Fresh when trying to switch over to npm: specifiers. When using both preact-render-to-string and preact Deno loads multiple copies of Preact. This breaks preact'...

Did you find this page helpful?