-
Notifications
You must be signed in to change notification settings - Fork 5.6k
DENO_AUTH_TOKENS does not authenticate against npm.pkg.github.com #19900
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
Comments
currently there doesn't seem to be any authorization tokens sent to npm registery? the request here is sent immediately without setting additional authorization header Line 353 in d6e086d
|
Maybe that's why it's not working for me. It's possible to install public npm packages with But it seems its not possible to install private npm packages? My use case is that we have private npm packages which we need for backwards compatibility, I want to use them in Deno without the need to maintain a deno fork version of those packages. The most seamless and easy way would be just to provide a way to install npm private packages, perhaps there is another way, I just didn't find any in the docs |
this is a blocker using deno in my company too. @bartlomieju are there plans to address this issue in the near future? if not, i'm interested in opening a PR, but could you provide pointers?
my guess is also passing authorization token on |
Is there any progress here? I think, the "tools" are already there: We have |
I think #9508 relates to this. However, it still doesn't respect the The only reliable way I found to work around this fuckery was to enable the If you are using GitHub actions, you can mix - id: setupnode
name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://npm.pkg.github.com/'
- id: nodeauth
name: Authenticate to private npm registry
run: |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
npm install
- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
# Lint, compile, whatever. Using This however has two downsides:
Why not a simpler way?You can get away with a simple implementation like:
@yourgithub-org:registry=https://npm.pkg.github.com/
//npm.pkg.github.com/:_authToken=yourAuthToken However, doing this makes $ deno compile --output=build/denobin ./main.ts && ./build/denobin
error: [ERR_MODULE_NOT_FOUND] Cannot find module 'file:///tmp/deno-compile-denobin/node_modules/localhost/@my-org/examplelib/0.1.0/index.js' imported from 'file:///tmp/deno-compile-denobin/denobin/lib/core/files/addFunctions.ts' If you try exploring,
29/08/2024 update: You should be able to get everything up and running if you keep the However, if you have your CI/CD in GitHub actions, you might encounter a For Dockerfiles you may use this: # First define your NODE_AUTH_TOKEN env var
export NODE_AUTH_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx RUN echo "@your-company:registry=https://npm.pkg.github.com/" > .npmrc && \
echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc && \
deno cache index.ts && deno task compile && \ # Assuming you have a "compile" task in your deno.json
rm .npmrc I really don't blame deno for this, npm ways tend to be unsuprisingly annoying sometimes. |
Hi,
I'm doing a POC to see if our company can start replacing node with deno.
I have a private npm package in
npm.pkg.github.com
that I'm trying to import.I'm trying to run a single-line file to install the package locally:
running the following command:
results in this error:
If I send a request with a client (like curl), it works, I get all the data about the package:
Thanks for your time!
The text was updated successfully, but these errors were encountered: