npmrc token not working using env variables
Unanswered
G0dw1ll posted this in #help-forum
G0dw1llOP
Im using AWS_amplify of hosting app , I added variable in .env.local file
NEXT_PUBLIC_NPM_CONFIG_AUTH_TOKEN=toekn_value
NPM_CONFIG_AUTH_TOKEN=toekn_value
and in .npmrc file , accessing it like
//registry.npmjs.org/:_authToken=$process.env.NPM_CONFIG_AUTH_TOKEN
//registry.npmjs.org/:_authToken=$process.env.NEXT_PUBLIC_NPM_CONFIG_AUTH_TOKEN
but it not working |
any help ???
NEXT_PUBLIC_NPM_CONFIG_AUTH_TOKEN=toekn_value
NPM_CONFIG_AUTH_TOKEN=toekn_value
and in .npmrc file , accessing it like
//registry.npmjs.org/:_authToken=$process.env.NPM_CONFIG_AUTH_TOKEN
//registry.npmjs.org/:_authToken=$process.env.NEXT_PUBLIC_NPM_CONFIG_AUTH_TOKEN
but it not working |
any help ???
2 Replies
Burmese
an .npmrc file is just a text file, so you can't just inject env vars like that... (unless the aws amplify platform is doing soimething special)
But what I have done before is set it up as part of your ci steps, or in your npm scripts to create the file. something like
But what I have done before is set it up as part of your ci steps, or in your npm scripts to create the file. something like
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrcBurmese
and depending on how things are set up, you may need to actually load that .env file first