heroku-buildpack-nodejs icon indicating copy to clipboard operation
heroku-buildpack-nodejs copied to clipboard

npm is not using cache

Open gtournie opened this issue 1 year ago • 2 comments

I just setup a new droplet on Digital Ocean, with the latest Ubuntu. I just use a minimal configuration:

dokku apps:create app
dokku config:set app NPM_CONFIG_PRODUCTION=false
dokku config:set app NODE_MODULES_CACHE=true
dokku domains:set app xxx.com

(Buildpack is automatically detected and installed. It installs heroku-buildpacks-nodejs by default)

Thing is, everytime I push on dokku it says:

-----> Restoring cache
       - npm cache (not cached - skipping)

Here's my env:

"engines": {
    "node": "18.16.0",
    "npm": "9.5.1"
  },

Is there something I forgot to do to activate npm's cache?

gtournie avatar Dec 24 '23 16:12 gtournie

Hi! It looks like you are using the classic Heroku Node.js buildpack, rather than the WIP next-gen Cloud Native Buildpack. Moving this issue to the correct repo :-)

edmorley avatar Jan 15 '24 17:01 edmorley

@gtournie we don't test our buildpack with Digital Ocean + dokku so it's hard to say why your npm cache is not being restored and there are currently no issues with npm caching on Heroku.

That said, based on the configuration you've noted above, the only reason I can see for why the cache wouldn't be restored is if the cached folder was not stored during the previous build. At the end of a build is does the following output appear?

Caching build
- node_modules

colincasey avatar Jan 15 '24 19:01 colincasey