Akos
06/22/2021, 2:13 PMbefore_compile:
- n auto
# This ensures that post-install hooks are run in CI in Ubuntu
# <https://github.com/npm/npm/issues/3497>
- npm install --unsafe-perm
Akos
06/22/2021, 2:14 PMFrank
Akos
06/22/2021, 2:47 PMAkos
06/22/2021, 2:49 PMnpm install
command that seed does by default? I can't seem to find it here: https://seed.run/docs/adding-a-build-spec.htmlAkos
06/22/2021, 2:49 PMmv package.json package.json.tmp
and a mv package.json.tmp package.json
solve that? 😄Frank
npm install
?Akos
06/22/2021, 6:51 PMFrank
npm ci
end up being much slower than npm install
. npm ci
wipes out the node_modules
and does a fresh install. It does use the .npm
cache. With .npm
cache, npm does’t have to re-download the modules, but it still need to build the dependency tree and etc, which is where most time is spent.Akos
06/22/2021, 7:02 PMThibault
09/02/2021, 3:11 PMnpm install
? like --production
Thibault
09/02/2021, 3:15 PM4m10s
but it took 154.75s
to run npm install
More than 50% of the build time has been spent on the package installation 😢Frank
npm install
only gets run if package.json
or package-lock.json
is changed; or on force deploy
.Frank
Thibault
09/02/2021, 3:24 PMThibault
09/02/2021, 3:25 PMnpm install
executed also installs the devDependencies?Thibault
09/02/2021, 3:27 PMdevDependencies
and I don't really need it for the deploymentThibault
09/02/2021, 3:36 PM→ npm i
added 2989 packages, and audited 2990 packages in 4m
→ npm i --production
added 560 packages, and audited 561 packages in 51s
Frank
NODE_ENV
to production
? That should skip the devDependencies.Frank
seed.yml
buildspec.Thibault
09/02/2021, 3:45 PMThibault
09/02/2021, 3:45 PMThibault
09/03/2021, 9:19 AMNODE_ENV
to production
is not a good option cause I use serverless-seed
and it's defined in the devDependencies
so I have to install them. But a good alternative is to use the before_compile
hook and do
echo progress=false >> ~/.npmrc
It disables the progress bar and reduce drastically the installation time 🎉
INFO: before_compile hook not found. You can define it in your build spec.
INFO: Learn more about adding a build spec - seed.run/docs/adding-a-build-spec
INFO: Looking for package.json...
$ npm install
added 2726 packages, and audited 2727 packages in 3m
INFO: Running before_compile hook
$ echo progress=false >> ~/.npmrc
INFO: Looking for package.json...
$ npm install
added 2726 packages, and audited 2727 packages in 49s
Thibault
09/03/2021, 9:39 AMFrank
Thibault
09/06/2021, 8:30 AMFrank