Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Both npm registry and yarn registry are not working #6242

Open
xuyuanxiang opened this issue Aug 7, 2018 · 6 comments
Open

Both npm registry and yarn registry are not working #6242

xuyuanxiang opened this issue Aug 7, 2018 · 6 comments

Comments

@xuyuanxiang
Copy link

When I upgrade yarn from 1.6.0 to 1.9.0, the following script execution failed.

#!/usr/bin/env node
const { execSync } = require('child_process');
const { dirname } = require('path');

const npmOriginRegistry = execSync('npm config get registry', {
  stdio: 'pipe',
  encoding: 'utf8',
});
execSync('npm config set registry https://registry.npm.wosai-inc.com/');

try {
  tryYarn();
} catch (e) {
  execSync('npm install -g @wosai/chiron-script', {
    stdio: 'inherit',
    encoding: 'utf8',
  });
} finally {
  execSync(`npm config set registry ${npmOriginRegistry}`);
}

function tryYarn() {
  const yarnOriginRegistry = execSync('yarn config get registry', {
    stdio: 'pipe',
    encoding: 'utf8',
  });
  execSync('yarn config set registry https://registry.npm.wosai-inc.com/ -g');
  try {
    const bin = execSync('yarn global bin', {
      stdio: 'pipe',
      encoding: 'utf8',
    });
    const prefix = dirname(bin);
    execSync(`yarn config set prefix ${prefix}`);
    execSync(
      `yarn global add @wosai/chiron-script --prefix ${prefix}`,
      {
        stdio: 'inherit',
        encoding: 'utf8',
      },
    );
  } catch (e) {
    throw e;
  } finally {
    execSync(`yarn config set registry ${yarnOriginRegistry} -g`);
  }
}

errors:

error An unexpected error occurred: "https://registry.yarnpkg.com/@wosai%2fchiron-script: Not found".

Both npm config set registry ... and yarn config set registry ... are not working

@ghost ghost assigned Daniel15 Aug 7, 2018
@ghost ghost added the triaged label Aug 7, 2018
@Daniel15
Copy link
Member

Daniel15 commented Aug 7, 2018

I don't see a package with the name of @wosai/chiron-script and can't install it using npm either:

C:\temp\testyarn1
λ npm install @wosai/chiron-script
npm ERR! code E404
npm ERR! 404 Not Found: @wosai/chiron-script@latest

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\danlo\AppData\Roaming\npm-cache\_logs\2018-08-07T19_01_06_032Z-debug.log

If this is a registry bug (the package is supposed to exist but doesn't), you'll need to contact npm's support.

@Daniel15 Daniel15 closed this as completed Aug 7, 2018
@xuyuanxiang
Copy link
Author

Before executing yarn global add ..., I have used npm config set registry ... and yarn config set registry ... -g to switch to a self-built repository: https://registry.npm.wosai-inc.com/.

@Daniel15
Copy link
Member

Daniel15 commented Aug 8, 2018

Hmmm... And it still doesn't work even after doing that? What if you do it manually rather than in a script?

@Daniel15 Daniel15 reopened this Aug 8, 2018
@xuyuanxiang
Copy link
Author

~ yarn config get registry
https://registry.yarnpkg.com~ npm config get registry
https://registry.npm.wosai-inc.com/~ yarn config set registry https://registry.npm.wosai-inc.com/
yarn config v1.9.2
success Set "registry" to "https://registry.npm.wosai-inc.com/".
✨  Done in 0.04s.~ yarn global add @wosai/chiron-script
yarn global v1.9.2
[1/4] 🔍  Resolving packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/@wosai%2fchiron-script: Not found".
info If you think this is a bug, please open a bug report with the information provided in "/Users/xuyuanxiang/.config/yarn/global/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.

@Daniel15 Daniel15 removed their assignment Aug 8, 2018
@Daniel15
Copy link
Member

Daniel15 commented Aug 8, 2018

Thanks... Looks like a bug!

@zwwtj2014
Copy link

v1.9.4 is ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants