[Pages] remove non working private packages section npm-private-registry.md - #1334
Closed
mckalexee wants to merge 1 commit into
Closed
[Pages] remove non working private packages section npm-private-registry.md#1334mckalexee wants to merge 1 commit into
mckalexee wants to merge 1 commit into
Conversation
While this section does work when testing locally, it does not appear to work correctly when actually deploying with CloudFlare Pages.
After the initial `npm install` process is started inside CloudFlare any changes to the `.npmrc` file do not appear to be respected.
## Steps to Reproduce
I created the `.npmrc.pages` file following the guide here, and modified the `preinstall` script for the `package.json` according to the guide.
Here's the `.npmrc.pages` file that I used. `my_org` was actually the organization that I have private packages installed.
```
//npm.pkg.github.com/:_authToken=${TOKEN_FOR_GITHUB}
@my_org:registry=https://npm.pkg.github.com/my_org
```
I created and tested the token used for `TOKEN_FOR_GITHUB` and loaded it into CloudFlare Pages.
I verified that running this locally correctly moved the `.npmrc.pages` file and installed packages.
I deployed to CloudFlare pages and received this error during the Building Application process
```
13:05:36.876 npm ERR! code E401
13:05:36.878 npm ERR! Unable to authenticate, need: Basic realm="GitHub Package Registry"
```
I manually copied over the `.npmrc.pages` file to `.npmrc`, committed the results, and re-deployed. This time the deployment was successful.
The conclusion here is that modifying the `.npmrc` in CloudFlare Pages using the `preinstall` is not a functional way to authenticate private registries, and CloudFlare Pages will need to make some changes on their side to support private registries.
Using `//npm.pkg.github.com/:_authToken=${TOKEN_FOR_GITHUB}` in the `.npmrc` currently is not tenable due to the fact that it breaks all local development environments.
Author
|
@lukeed It looks like you previously added this documentation. I wanted to tag you here just to make sure I'm not missing something, or to see if you were able to get this to work. Thanks! |
Contributor
|
Hey there, did you end up getting this working? Not sure if I was speaking with you or someone else on Discord, but this appears (or was) a GitHub Token permission issue. |
This was referenced Jun 24, 2021
This was referenced Jul 5, 2021
Contributor
|
Closing this as it looks to be an issue w/ GitHub token permissions |
This was referenced Jul 19, 2021
This was referenced Jul 28, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Steps to Reproduce
.npmrc.pagesfile following the guide here, and modified thepreinstallscript for thepackage.jsonaccording to the guide.Here's the
.npmrc.pagesfile that I used.my_orgwas actually the organization that I have private packages installed.Create the token used for
TOKEN_FOR_GITHUBand load it into CloudFlare Pages.Verify running this locally correctly moes the
.npmrc.pagesfile and installs packages.Deploy to CloudFlare pages
I received this error during the Building Application process
I manually copied over the
.npmrc.pagesfile to.npmrc, committed the results, and re-deployed. This time the deployment was successful.The conclusion here is that modifying the
.npmrcin CloudFlare Pages using thepreinstallis not a functional way to authenticate private registries, and CloudFlare Pages will need to make some changes on their side to support private registries.Using
//npm.pkg.github.com/:_authToken=${TOKEN_FOR_GITHUB}in the.npmrccurrently is not tenable due to the fact that it breaks all local development environments.