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

[tfjs-node]Support cnpm registry #3832

Merged
merged 4 commits into from
Sep 24, 2020

Conversation

SirM2z
Copy link
Contributor

@SirM2z SirM2z commented Aug 19, 2020

Support taobao npm mirror.

When tfjs-node is installed, it will download files from storage.googleapis.com.

In China, the cnpm tool will be used to solve network problems, and it will proxy the above-mentioned link to the mirror site.

However, when some people only use the parameter (--registry=https://registry.npm.taobao.org) to install, they cannot proxy.

This pr is to solve this problem: only use the link installed by the parameter (--registry=https://registry.npm.taobao.org)


This change is Reviewable

@SirM2z
Copy link
Contributor Author

SirM2z commented Sep 3, 2020

Pass the url through the environment variable STORE_BASE_HOST=https://cdn.npm.taobao.org/dist/

const BASE_HOST = process.env.STORE_BASE_HOST;

But for the developer, he does not know this url: https://cdn.npm.taobao.org/dist/.
So is it possible to tell the developer this information in the installation document

Copy link
Collaborator

@pyu10055 pyu10055 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pass the url through the environment variable STORE_BASE_HOST=https://cdn.npm.taobao.org/dist/

const BASE_HOST = process.env.STORE_BASE_HOST;

But for the developer, he does not know this url: https://cdn.npm.taobao.org/dist/.
So is it possible to tell the developer this information in the installation document

Thanks, Is this change pushed?

tfjs-node/scripts/install.js Outdated Show resolved Hide resolved
@SirM2z
Copy link
Contributor Author

SirM2z commented Sep 22, 2020

Pass the url through the environment variable STORE_BASE_HOST=https://cdn.npm.taobao.org/dist/

const BASE_HOST = process.env.STORE_BASE_HOST;

But for the developer, he does not know this url: https://cdn.npm.taobao.org/dist/.
So is it possible to tell the developer this information in the installation document

Thanks, Is this change pushed?

already pushed

@pyu10055 pyu10055 merged commit 62d0dec into tensorflow:master Sep 24, 2020
@joebnb
Copy link

joebnb commented Nov 30, 2020

should i use it like npm config set STORE_BASE_HOST URL ?

could give a example url of path corresponding

Copy link

@joebnb joebnb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could change it before tfjs-node publish?

@@ -42,8 +42,9 @@ const mkdir = util.promisify(fs.mkdir);
const rename = util.promisify(fs.rename);
const rimrafPromise = util.promisify(rimraf);

const BASE_URI =
'https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-';
const CDN_STORAGE = process.env.CDN_STORAGE;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

process.env.CND_STORAGE name as process.env.TFJS_NODE_MIRROR may more meaningful

@joebnb
Copy link

joebnb commented Nov 30, 2020

it's seems already published,i track this from a old third node modules😰 pity for that, but we can also use

const CDN_STORAGE = process.env.CDN_STORAGE || process.env.TFJS_NODE_MIRROR;

make it work

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

Successfully merging this pull request may close these issues.

None yet

4 participants