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

Unable to download the canvas-prebuilt binary through a mirror #1346

Closed
Boshen opened this issue Jan 7, 2019 · 8 comments · Fixed by #1347
Closed

Unable to download the canvas-prebuilt binary through a mirror #1346

Boshen opened this issue Jan 7, 2019 · 8 comments · Fixed by #1347

Comments

@Boshen
Copy link
Contributor

Boshen commented Jan 7, 2019

We'd like to download canvas-prebuilt from a mirror because we are behind the great firewall.

We can achieve this because node-pre-gyp supports it.
But we failed to do so because the module_name specified in package.json doesn't match the naming convention mentioned in node-pre-gyp, which says: "Must be a valid C variable name (e.g. it cannot contain -)".

I have cloned the repo and changed the module_name from canvas-prebuilt to canvas_prebuilt and it worked:

node-pre-gyp http GET https://npm.taobao.org/mirrors/canvas-prebuilt/v2.2.0/canvas_prebuilt-v2.2.0-node-v67-darwin-unknown-x64.tar.gz

Happy to send a pr if this doesn't break anything

@chearon
Copy link
Collaborator

chearon commented Jan 7, 2019

Sure, it should probably be canvas now anyways. I'll fix it in the next update

node-gfx/node-canvas-prebuilt#72

@chearon
Copy link
Collaborator

chearon commented Jan 7, 2019

(If you wanted to make a PR you should only have to change module_name in package.json in this repo; I'll have to make a slightly bigger change in the prebuilt repo too though)

@Boshen
Copy link
Contributor Author

Boshen commented Jan 9, 2019

Thanks!

@icfantv
Copy link

icfantv commented Apr 2, 2019

@Boshen dumb question: i'm assuming we can host the binaries on our artifactory server and if we do this, what does the yarn install process now look for an entire project (rather than just installing one dependency from a mirror)? I.e., when I execute yarn install for my project, how do I tell it to download the canvas binaries from the mirror but use NPM for everything else? TIA.

@plantain-00
Copy link

yarn install --verbose > a.txt, there will be logs

@icfantv
Copy link

icfantv commented Apr 3, 2019

@plantain-00 sorry, I must be missing something...How does this help me? I see in the log where I'm downloading the binary, but this doesn't answer my question of how to do a yarn install for my entire project while overriding the download host for just the node-canvas binaries.

node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | darwin | x64
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp info check checked for "/Users/adam.gordon/code/pt-sheets-viewer/node_modules/canvas/build/Release/canvas.node" (not found)
node-pre-gyp http GET https://github.com/node-gfx/node-canvas-prebuilt/releases/download/v2.4.1/canvas-v2.4.1-node-v67-darwin-unknown-x64.tar.gz
node-pre-gyp http 200 https://github.com/node-gfx/node-canvas-prebuilt/releases/download/v2.4.1/canvas-v2.4.1-node-v67-darwin-unknown-x64.tar.gz

@plantain-00
Copy link

plantain-00 commented Apr 3, 2019

@icfantv

  1. download the binary(the url can be found in the logs)
  2. put the binary in your file server(like amazon s3), and can be downloaded by like https://your-server/canvas-v2.4.1-node-v67-darwin-unknown-x64.tar.gz
  3. add your url to enironment variable canvas_binary_host_mirror
  4. yarn install again and see urls in the logs

https://github.com/mapbox/node-pre-gyp#download-binary-files-from-a-mirror

@icfantv
Copy link

icfantv commented Apr 4, 2019

@plantain-00 ah! I will try that tomorrow. Thanks!

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

Successfully merging a pull request may close this issue.

4 participants