connect-deps icon indicating copy to clipboard operation
connect-deps copied to clipboard

Added npm version check

Open Dzeri96 opened this issue 3 years ago • 2 comments

When using an npm version 6.x.x, npm pack wrongly parses git output, producing the following error:

Error: ENOENT: no such file or directory, rename '/redacted/.connect-deps-cache/Your branch is up to date with 'origin/master'.
typeorm-test-transactions-1.14.2.tgz' -> '/redacted/.connect-deps-cache/typeorm-test-transactions-1.14.2-1615418598555.tgz'
    at Object.renameSync (fs.js:772:3)
    at Object.pack (/home/redacted/connect-deps/cli.js:104:16)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async packInstall (/home/redacted/connect-deps/cli.js:321:13)
    at async connect (/home/redacted/connect-deps/cli.js:215:5)

I could have added npm ^7.x.x to the dependencies, but this is unnecessary for people using yarn (and it adds extra bulk to the package). Instead, I implemented a function that checks if the global npm version is compatible with v7 and throws an error if it isn't.

Dzeri96 avatar Mar 11 '21 01:03 Dzeri96

can you explain this better, i have used connect-deps with npm 6. maybe a way for me to replicate this issue ?

hugomrdias avatar Mar 17 '21 12:03 hugomrdias

It might just be that I had a very specific version of npm that caused this bug. I'm not sure if I can find it now since I updated to get rid of it. Basically what happened was, npm pack ran some git commands in the background and parsed the second line, which would normally give the current directory. For some reason git would output three lines, where the second one was Your branch is up to date with origin/master. If I could somehow find out which npm version I had, we could try to reproduce it. I just assumed the package might be broken for npm < v7

Dzeri96 avatar Mar 18 '21 20:03 Dzeri96