yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.44k stars 2.73k forks source link

Yarn install fails Error: Failed to replace env in config: ${NPM_TOKEN} #6130

Open q3e opened 6 years ago

q3e commented 6 years ago

What is the current behavior? same as https://github.com/npm/npm/issues/19169

Yarn error log:

Arguments:
  /usr/local/bin/node /usr/local/Cellar/yarn/1.7.0/libexec/bin/yarn.js

PATH:
  /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Yarn version:
  1.7.0

Node version:
  8.11.1

Platform:
  darwin x64

Trace:
  Error: Failed to replace env in config: ${NPM_TOKEN}
      at /usr/local/Cellar/yarn/1.7.0/libexec/lib/cli.js:96162:13
      at String.replace (<anonymous>)
      at envReplace (/usr/local/Cellar/yarn/1.7.0/libexec/lib/cli.js:96157:16)
      at Function.normalizeConfig (/usr/local/Cellar/yarn/1.7.0/libexec/lib/cli.js:31284:69)
      at NpmRegistry.<anonymous> (/usr/local/Cellar/yarn/1.7.0/libexec/lib/cli.js:31314:34)
      at Generator.next (<anonymous>)
      at step (/usr/local/Cellar/yarn/1.7.0/libexec/lib/cli.js:98:30)
      at /usr/local/Cellar/yarn/1.7.0/libexec/lib/cli.js:109:13
      at <anonymous>
ezhlobo commented 6 years ago

@fatahn that happens because NPM_TOKEN is not specified.

SpencerSherk commented 5 years ago

cd to root, run: source .bashrc (and make sure your .bashrc file is correctly configured)

lirbank commented 5 years ago

I think NPM_TOKEN should expand to "" by default. In our case we use the NPM_TOKEN to have our CI server publish new private packages. For other uses (locally), like for example yarn outdated it is not needed. As it is, every developer need to set NPM_TOKEN='' in their bash profile, just to make yarn work.

AshwinTayson commented 3 years ago

Any solution for this? Alot of CI/CD deployments are blocked because of this

technicalpickles commented 1 year ago

I ran into this with yarn v1.22.19. I understand the error message is saying the NPM_TOKEN isn't set, however... as a user, I'm not sure why that would be. I was trying to run yarn in a project I hadn't run before and was getting this error.

A workaround I found is this: NPM_TOKEN= yarn

b8zeek commented 2 days ago

Come on; you are better that this! 😨