rogeriochaves / npm-force-resolutions

Force npm to install a specific transitive dependency version
567 stars 28 forks source link

not working anymore #28

Closed g-bastianelli closed 3 years ago

g-bastianelli commented 3 years ago

Hello. Its what i havsince your release.

 npx npm-force-resolutions

Need to install the following packages:
  npm-force-resolutions
Ok to proceed? (y) y
TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received null
    at Function.from (buffer.js:333:9)
    at /Users/g-bastianelli/Projects/kronos/node_modules/npm-force-resolutions/out/npm_force_resolutions/core.cljs:26:36
    at npm_force_resolutions$core$build_dependency_from_dist (/Users/g-bastianelli/Projects/kronos/node_modules/npm-force-resolutions/out/npm_force_resolutions/core.js:30:3)
    at switch__2144__auto__ (/Users/g-bastianelli/Projects/kronos/node_modules/npm-force-resolutions/out/npm_force_resolutions/core.cljs:32:3)
    at /Users/g-bastianelli/Projects/kronos/node_modules/npm-force-resolutions/out/npm_force_resolutions/core.cljs:32:3
    at npm_force_resolutions$core$fetch_resolved_resolution_$_state_machine__2145__auto____1 (/Users/g-bastianelli/Projects/kronos/node_modules/npm-force-resolutions/out/npm_force_resolutions/core.js:95:4)
    at cljs.core.async.impl.ioc-helpers/FN-IDX (/Users/g-bastianelli/Projects/kronos/node_modules/npm-force-resolutions/out/npm_force_resolutions/core.js:111:94)
    at cljs.core.async.impl.ioc-helpers/run-state-machine (/Users/g-bastianelli/Projects/kronos/node_modules/npm-force-resolutions/out/cljs/core/async/impl/ioc_helpers.cljs:35:23)
    at cljs.core.async.impl.ioc-helpers/run-state-machine-wrapped (/Users/g-bastianelli/Projects/kronos/node_modules/npm-force-resolutions/out/cljs/core/async/impl/ioc_helpers.cljs:39:6)
    at /Users/g-bastianelli/Projects/kronos/node_modules/npm-force-resolutions/out/cljs/core/async/impl/ioc_helpers.cljs:48:39

it's happening on my CI too. Node14 and npm 7

ihtisham-sohail commented 3 years ago

Same here, at first had an ES-Lint issue regarding this on GitHub, removed node-modules and tried to re-install, but facing the same error. Using Node v12.16.1 , NPM v6.13.4

irfanbabar15 commented 3 years ago

same here, suddenly my github eslint giving me this issue on PR, i tried npm install in my local code. Then I get this same issue in local as well.

CookieBox commented 3 years ago

We were able to resolve the issue by updating all of the items in "resolutions" within our packages.json. For us, we updated to the following and the problem went away. Can't specify this is a correct or valid fix, but it has resolved the issue for us :)

Original: "resolutions": { "https-proxy-agent": "2.2.4", "node-sass": "^4.13.1", "serialize-javascript": "^2.1.1", "tree-kill": "1.2.2" }

Updated: "resolutions": { "https-proxy-agent": "5.0.0", "node-sass": "5.0.0", "serialize-javascript": "5.0.1", "tree-kill": "1.2.2" }

I hope this helps!

g-bastianelli commented 3 years ago

Image from Gyazo

remove the ^ of the resolutions was the fix for me.

fabio-s-franco commented 3 years ago

Same happened here since the latest version was published. Thanks for sharing the workaround

fschulze commented 3 years ago

One can also use "npx npm-force-resolutions@0.0.6" to pin the used version in the "scripts" -> "preinstall" part.

g-bastianelli commented 3 years ago

One can also use "npx npm-force-resolutions@0.0.6" to pin the used version in the "scripts" -> "preinstall" part.

Wasn't working for me

irfanbabar15 commented 3 years ago

Image from Gyazo

remove the ^ of the resolutions was the fix for me.

IT Worked for me Thanks. But why ^ sign isn't working for resolution. any idea ?

g-bastianelli commented 3 years ago

I think that it's a matter of type. When we use ^ version handle as an object i guess and without as a string.

vfreitas- commented 3 years ago

I think it's an issue with the latest version (0.0.7). In my project, I did a downgrade and it worked nicely.

"preinstall": "npx npm-force-resolutions@0.0.6"
pagniezg commented 3 years ago

looks like its related with this commit : https://github.com/rogeriochaves/npm-force-resolutions/commit/986fb7c7068d963963b80cbdc046dbecf9669e42

my guessing : function is looking to the integrity hash in the dependencies. On some dependencies (had the problem with graceful-fs), this hash is empty and the method couldn't find sha-1 or base64 hash : crash.

jcardali commented 3 years ago

I think it's an issue with the latest version (0.0.7). In my project, I did a downgrade and it worked nicely.

"preinstall": "npx npm-force-resolutions@0.0.6"

I will be doing this going forward after multiple issues this week.

mredaelli commented 3 years ago

One can also use "npx npm-force-resolutions@0.0.6" to pin the used version in the "scripts" -> "preinstall" part.

Don't you love pinning the version of the version-pinner ^_^

createthis commented 3 years ago

You broke it AGAIN in the same week. lol. You guys need a better QA procedure.

danizep commented 3 years ago

Thank you! 😄 This bug triggered an improvement in our code by stop using npm-force-resolutions and fixing the actual problem! 😉

rogeriochaves commented 3 years ago

well, what can I say, sorry to be honest folks, I didn't even knew that ^ versions were supported, because I never really used like that, that's why I didn't have a unit test for it, it was working by accident so far

turns out npm is quite a complicated thing, when trying to fix other issues where integrity was not fetched properly, I end up breaking this one, because npm api does not support urls like https://registry.npmjs.org/hoek/^4.2.1, so I reversed to the old behaviour of not having integrity checks if version has ^ in it

should be fixed by 5734f5c98f37d9e55f6c1a74b17f2faece8724bc, and now released on v0.0.9, please let me know of any further issues

@danizep that's a great outcome! 😃

kalbert312 commented 3 years ago

~ doesn't seem to work. I stopped using ^ in favor of ~ in the rare event a package-lock.json needs to be regenerated as patch variations have less chance to break things.

rogeriochaves commented 3 years ago

@kalbert312 I will follow up on #29

fabio-s-franco commented 3 years ago

@rogeriochaves don't beat yourself up. Your work is saving us a lot of trouble and I am thankful for that. It's great the the community quickly found a workaround to this small hiccup and now there there is test coverage.

Keep up the good work :)