NPM run preinstall script at different times in the lifecycle, if a package is installed via npm ci
or npm install
This issue is the same than this one: https://npm.community/t/ci-and-install-run-preinstall-lifecycle-script-at-different-times/7317
Issue that got closed while being acknowledged as a bug.
When running npm i
the preinstall
script is ran before downloading a package.
When running npm ci
the preinstall
script is ran after downloading the package, before it is installed.
npm install/npm ci any project.
The script preinstall
should be run before downloading the package for npm ci
.
While running npm install
, we start a proxy, and packages are resolved trough this proxy.
When running npm ci
, the proxy doesn't start, and npm cannot resolve the package.
Now some package cannot even be installed using npm ci because the library author does not use npm ci and this bug break the package install.
We cannot use npm ci on some of our project because of this.
I believe these issues are the same bug: #454 & #452 .
Same here, I do some clean-up (including node_modules) on preinstall
in development with npm install
. In our CI pipeline this is done via npm ci
which installs the dependencies, after that preinstall
is deleting the node_modules folder because of the wrong execution order.
I'm also having this issue. I'm using npm install <folder>
to use my package in my integration tests, and that folder needs to be built before I run install. for now I'm just manually building it but I would like preinstall to handle this, or at least for there to be a "predownload" script or something
We have a similar use case. We're building a package from rust to create a wasm/js package, which we'd like to then install via a file reference. With npm ci
, this build step doesn't happen until the error of a missing package has already failed the install.
@trevor-scheer due to this bug we switched to yarn and it works without any issue.
They also answered the issues I opened, in less than one week :D.
Sadly not an option for us but thanks for the quick response @Kuinox! Glad you found a way around it 馃檪
Most helpful comment
@trevor-scheer due to this bug we switched to yarn and it works without any issue.
They also answered the issues I opened, in less than one week :D.