We have a scoped module, and for npm
to be be able to resolve it, we have to say where its repo is. This can be done in i.e. .npmrc
, such as:
@my-scope:registry=http://my-sweet-replication.example.com/npm/
My problem is that because of some proxying and authentication for GET requests, I have to put different values in .npmrc
for development versus the build server (travis enterprise). We already take advantage of the fact that npm
can read environment variables for packages that are not scoped, but as both @
and :
are invalid characters in an environment variable I'm unable to export the correct URL.
Any ideas on how to tell npm where to look for scoped modules without putting it in .npmrc
?
For now, my solution is to use the env
command, i.e. (in .travis.yml
)
install: env 'NPM_CONFIG_@MY-SCOPE:REGISTRY=http://my-sweet-replication.example.com/npm/' npm install
Is that the only way to do it?
Putting it in the travis env
matrix does not work, as it uses EXPORT
, so it tries to export just REGISTRY
(Posting my answer as I didn't get any hits from googling)