How to deploy Pages project with private NPM package dependencies?

Hey fellas, I'm trying to deploy a Next.js project with a private NPM package dependency to Pages, following https://developers.cloudflare.com/pages/how-to/npm-private-registry/#private-modules-on-the-npm-registry, I set NPM_TOKEN with an available value to both Production and Preview environment variables. But it still failed during building while deployment. Error says like "npm ERR! 404 Not Found - GET https://registry.npmjs.org/@aurora-quest/universal-authentication-types/-/universal-authentication-types-0.8.6.tgz - Not found". This project can be built successfully on my local environment with the same NPM_TOKEN value on Cloudflare, it's weird! Could anybody share some useful experience on this? That would be very appreciated!
Cloudflare Docs
Install private packages | Cloudflare Pages docs
Cloudflare Pages supports custom package registries, allowing you to include private dependencies in your application. While this walkthrough focuses specifically on npm, the Node package manager and registry, the same approach can be applied to other registry tools.
1 Reply
Want results from more Discord servers?
Add your server