Closed lvqq closed 1 year ago
I'm having a similar issue.
No this was very much intentional and npm is going to be moving even further in the direction of not allowing invalid configs. None of these would be looked at by npm or any of its submodules anyways.
Many NPM modules are using third-part URL for downloading something during installation. For some NPM usage (for sample: in company), these URLs should be proxified via an internal URL (private network, security reasons, ...).
Currently these configurations are stored in NPM config file => not allow anymore these properties will add complexity in NPM configuration ("manipulate" file manually, environment variables, ...).
I have in mind (--location user
not added here, as was done previously for NPM v8):
# phantomJS (https://github.com/Medium/phantomjs#deciding-where-to-get-phantomjs)
npm config set phantomjs_cdnurl http://registry.company.com/some-path/bitbucket/ariya/phantomjs
# node-sass (https://github.com/sass/node-sass#binary-configuration-parameters)
npm config set sass_binary_site http://registry.company.com/some-path-proxify-github/sass/node-sass/releases/download
# cypress (https://docs.cypress.io/guides/references/advanced-installation#Mirroring)
npm config set cypress_download_mirror http://registry.company.com/some-path
# sqlite3 (https://github.com/TryGhost/node-sqlite3/issues/1157)
npm config set node_sqlite3_binary_host_mirror http://registry.company.com/some-path-proxify-github/TryGhost/node-sqlite3/releases/download
# Any modules installed via 'node-pre-gyp' like 'node-libcurl'
npm config set node_libcurl_binary_host_mirror http://registry.company.com/some-path-proxify-github/JCMais/node-libcurl/releases/download
# Chromium via puppeteer
npm config set puppeteer_download_host http://registry.company.com/some-path-proxify-google-storage
This broke our workflow, but since we needed only one npm config var, I just hijacked one that isn't particularly important to NPM: npm config set heading This-is-my-custom-value
Have the same issue when I use npm config set user 0
, is there any replacement?
https://timjrobinson.com/fixing-node-gyp-permission-denied-when-running-as-root/
Have the same issue when I use
npm config set user 0
, is there any replacement? https://timjrobinson.com/fixing-node-gyp-permission-denied-when-running-as-root/
Have you found an answer to that yet? I can't work without it.
Have the same issue when I use
npm config set user 0
, is there any replacement? https://timjrobinson.com/fixing-node-gyp-permission-denied-when-running-as-root/Have you found an answer to that yet? I can't work without it.
Also interested in a solution
Have the same issue when I use
npm config set user 0
, is there any replacement? https://timjrobinson.com/fixing-node-gyp-permission-denied-when-running-as-root/Have you found an answer to that yet? I can't work without it.
Also interested in a solution
has anyone figured out the solution?
I found the solution to my issue but it's difficult to articulate because it's been a while. If I remember right, it was an issue with read/write permissions of my drive where I had my projects. So in /etc/fstab
I changed mount options corresponding to drive which contained projects to comment=x-gvfs-show,nls=utf8,uid=1000,gid=1000,dmask=0000,fmask=0022
and everything worked fine since then.
For those still searching for a solution; i worked 'around it' by including a .npmrc with the keys already in there. Only thing I needed to do was use the .npmrc in my pipeline and use 'sed' to update the file with the pipeline variable
So i was using:
script:
- npm config set sharp_local_prebuilds $CI_PROJECT_DIR/binaries/sharp/v0.32.6/
- npm config set sharp_libvips_local_prebuilds $CI_PROJECT_DIR/binaries/libvips/
And now I'm using
a .npmrc file with:
sharp_libvips_local_prebuilds = %PROJECT_DIR%/binaries/libvips/
sharp_local_prebuilds = %PROJECT_DIR%/binaries/sharp/v0.32.6/
And then in the step:
script:
- cp .gitlab/.npmrc .
- sed -i 's,%PROJECT_DIR%,'$CI_PROJECT_DIR',g' .npmrc
That's a pretty stupid change, CI pipelines are not working now because many dependencies use variables that we neep to set into the npm config (.npmrc)
Needing to update the .npmrc with bash script when npm config exist is really annoying...
How do I change distUrl in npm ? what's solution here?
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
Running
npm config -g test-key test-value
and I get:I am sad with this change since all custom configs cannot be set by running
npm config
. And is there any plans to remove this limit?Expected Behavior
npm config works fine while using custom config
Steps To Reproduce
Just run
npm config
with custom config:npm config -g set <custom-key> <custom-value>
Environment