CA
rare-sapphire
Problem building with private packages
Hi everyone, nice to be here 😁
I am writing to you about a problem with private packages on an Actor JS/Typescript- Engine Node 18.
I followed these steps:
- I created a secret with the NPM_GITHUB_TOKEN
- checked the option from GUI "Apply environment variables also to the build process"
- I added these lines to my Dockerfile
ARG NPM_GITHUB_TOKEN
ENV NPM_GITHUB_TOKEN=$NPM_GITHUB_TOKEN
and tried printing the value of the NPM_GITHUB_TOKEN in the build (it works)
- I correctly created the .npmrc file that uses the NPM_GITHUB_TOKEN
I always get this error:
npm ERR!
2023-12-02T07:09:42.306Z 401 Unauthorized - GET https://npm.pkg.github.com/download/.........
Locally everything works correctly.
Has anyone had and solved a similar problem? I searched in old posts but couldn't find anything.
Thanks7 Replies
correct-apricot•2y ago
We did with adding this to Dockerfile before
npm install
Then having .npmrc
file on top level with something like this
rare-sapphireOP•2y ago
ahh thanks @Lukas Krivka , now it works, I was missing that little detail about not copying the .npmrc file, that had to be done in two different points
I also find out that it seems that it's possible to tell apify to apply env variable also during build time only from the GUI like this, there's no other way? I'm creating actor via apify-cli using apify-cli push and planning to automating it via github actions and obviously this will not work with this
rare-sapphireOP•2y ago

correct-apricot•2y ago
This should be possible via API but not sure if CLI, good point, I will pass it to the team
rare-sapphireOP•2y ago
Hi @Lukas Krivka , by any change any update from the team on this?
@milloome just advanced to level 1! Thanks for your contributions! 🎉
correct-apricot•2y ago
Nope, I would not waitt for this for now