Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm is not using cache #1194

Open
gtournie opened this issue Dec 24, 2023 · 3 comments
Open

npm is not using cache #1194

gtournie opened this issue Dec 24, 2023 · 3 comments

Comments

@gtournie
Copy link

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?

@edmorley
Copy link
Member

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 edmorley transferred this issue from heroku/buildpacks-nodejs Jan 15, 2024
@colincasey
Copy link
Contributor

@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

@nickolay
Copy link

(I'll note here that dokku does cache npm modules normally (-----> Restoring cache\n - npm cache)

But this buildpack appears to reinstall node/npm (and maybe node_modules from the npm cache?) even on heroku — in #914 the author was happy with 15 second build time even when hitting cache...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants