Awakening causes request timeouts due to NPM reinstall


#1

When my app has been asleep and a web request wakes it, it appears that NPM packages are reinstalled. In turn, then, the installer for the better-sqlite3 package rebuilds sqlite3 via gyp whether it needs it or not. Because that rebuild takes a while:

node v8.9.4, with pnpm
Installing...
A store server is running. All store manipulations are delegated to it.
Already up-to-date
Packages: +89
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Running install for registry.npmjs.org/better-sqlite3/4.1.0: ==> cwd: /rbd/pnpm-volume/de140b15-6961-4165-a750-fccbe3965b72/node_modules/.registry.npmjs.org/better-sqlite3/4.1.0/node_modules/better-sqlite3
Running install for registry.npmjs.org/better-sqlite3/4.1.0: ==> /rbd/pnpm-volume/de140b15-6961-4165-a750-fccbe3965b72/node_modules/.registry.npmjs.org/lzz-gyp/0.4.2/node_modules/lzz-gyp/lzz-compiled/linux -hx hpp -sx cpp -k BETTER_SQLITE3 -d -hl -sl -e ./src/better_sqlite3.lzz
Running install for registry.npmjs.org/better-sqlite3/4.1.0: ==> cwd: /rbd/pnpm-volume/de140b15-6961-4165-a750-fccbe3965b72/node_modules/.registry.npmjs.org/better-sqlite3/4.1.0/node_modules/better-sqlite3
Running install for registry.npmjs.org/better-sqlite3/4.1.0: ==> node-gyp rebuild
...
Running install for registry.npmjs.org/integer/1.0.3! gyp info ok 
Running install for registry.npmjs.org/integer/1.0.3, done

dependencies:
+ @slack/client 3.16.0
+ better-sqlite3 4.1.0

Total install time: 100947ms

…the web request times out. Is there a way to prevent NPM reinstallation on startup? Or, is there some way to make gyp not actually recompile sqlite3 if it’s already present?


#2

That shouldn’t happen - it should only reinstall on changes to package.json, unless you’ve changed the behavior with a watch.json file or your start command tells it to somehow. What’s the name of your project so we can take a look at what’s up?


#3

The project is sjv-database-bot. Thanks!


#4

Ah, so this results from us having to disable a cache while we’re working on some things. It will be fixed up soon.