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

Fails on Windows when tarPath is overridden manually #1924

Closed
s100 opened this issue Oct 16, 2019 · 2 comments
Closed

Fails on Windows when tarPath is overridden manually #1924

s100 opened this issue Oct 16, 2019 · 2 comments

Comments

@s100
Copy link
Contributor

s100 commented Oct 16, 2019

  • Node Version: 10.16.3, npm version 6.9.0, node-gyp version 3.8.0
  • Platform: Windows
  • Compiler:
  • Module: appmetrics
Verbose output (from npm or node-gyp):
gyp verb tarball done parsing tarball
gyp verb on Windows; need to download `node.lib`...
gyp verb 32-bit node.lib dir C:\Users\s100\.node-gyp\10.16.3\ia32
gyp verb 64-bit node.lib dir C:\Users\s100\.node-gyp\10.16.3\x64
gyp verb `node.lib` 32-bit url https://nodejs.org/download/release/v10.16.3/win-x86/node.lib
gyp verb `node.lib` 64-bit url https://nodejs.org/download/release/v10.16.3/win-x64/node.lib
gyp verb streaming 32-bit node.lib to: C:\Users\s100\.node-gyp\10.16.3\ia32\node.lib
gyp http GET https://nodejs.org/download/release/v10.16.3/win-x86/node.lib
gyp verb streaming 64-bit node.lib to: C:\Users\s100\.node-gyp\10.16.3\x64\node.lib
gyp http GET https://nodejs.org/download/release/v10.16.3/win-x64/node.lib
gyp http 200 https://nodejs.org/download/release/v10.16.3/win-x64/node.lib
gyp http 200 https://nodejs.org/download/release/v10.16.3/win-x86/node.lib
gyp verb content checksum win-x64/node.lib 9f10cd25d27fc31f8fe8f5fcc5e9f27a8ba5bb79dc0791dc0df102f063c0066e
gyp verb content checksum win-x86/node.lib 459095d9bd9dc4e2d12c4284e6fc5bdc78eec8181c8327c57876499b002a59fd
gyp verb download contents checksum {"win-x64/node.lib":"9f10cd25d27fc31f8fe8f5fcc5e9f27a8ba5bb79dc0791dc0df102f063c0066e","win-x86/node.lib":"459095d9bd9dc4e2d12c4284e6fc5bdc78eec8181c8327c57876499b002a59fd"}
gyp verb validating download checksum for win-x64/node.lib (9f10cd25d27fc31f8fe8f5fcc5e9f27a8ba5bb79dc0791dc0df102f063c0066e == undefined)
gyp WARN install got an error, rolling back install

We are installing appmetrics, a package requiring the compilation of native code, on Windows. We have the location of the Node.js headers tarball overridden, so instead of curling https://nodejs.org/dist/v10.16.3/node-v10.16.3-headers.tar.gz, we have done something like npm config set tarball C:\node-v10.16.3-headers.tar.gz, as suggested in #1133.

From the code we see that if we are on Windows and have overridden the tarball location by setting tarPath, node-gyp:

  1. downloads node.lib, populating contentShasums with its SHA256 hash (downloadNodeLib)
  2. does not download expected SHA256 sums and populate expectShasums (downloadShaSums, which is not called)
  3. still compares the two SHA256 sums (deref) - so it compares a valid SHA256 with undefined and fails.

Compare with this output if I npm config delete tarball:

when it works
gyp verb tarball done parsing tarball
gyp verb on Windows; need to download `node.lib`...
gyp verb 32-bit node.lib dir C:\Users\s100\.node-gyp\10.16.3\ia32
gyp verb 64-bit node.lib dir C:\Users\s100\.node-gyp\10.16.3\x64
gyp verb `node.lib` 32-bit url https://nodejs.org/download/release/v10.16.3/win-x86/node.lib
gyp verb `node.lib` 64-bit url https://nodejs.org/download/release/v10.16.3/win-x64/node.lib
gyp verb check download content checksum, need to download `SHASUMS256.txt`...
gyp verb checksum url https://nodejs.org/download/release/v10.16.3/SHASUMS256.txt
gyp http GET https://nodejs.org/download/release/v10.16.3/SHASUMS256.txt
gyp verb streaming 64-bit node.lib to: C:\Users\s100\.node-gyp\10.16.3\x64\node.lib
gyp http GET https://nodejs.org/download/release/v10.16.3/win-x64/node.lib
gyp verb streaming 32-bit node.lib to: C:\Users\s100\.node-gyp\10.16.3\ia32\node.lib
gyp http GET https://nodejs.org/download/release/v10.16.3/win-x86/node.lib
gyp http 200 https://nodejs.org/download/release/v10.16.3/SHASUMS256.txt
gyp verb checksum data {"node-v10.16.3-aix-ppc64.tar.gz":"1e246436e177d69354b5e3ea47579a03b68d7b61a2565972c18c3a4cb5d8ee33","node-v10.16.3-darwin-x64.tar.gz":"6febc571e1543c2845fa919c6d06b36a24e4e142c91aedbe28b6ff7d296119e4","node-v10.16.3-darwin-x64.tar.xz":"1d5ce05abf39ef482c2c3eaf16c1f4edb01314308066871d3dfc99e95701b19b","node-v10.16.3-headers.tar.gz":"0901d1f1bfe0f5d922f9d79c5822a3624c11eb0f2de9fd552425bc98c7b95e54","node-v10.16.3-headers.tar.xz":"6ceb3249ac26a098c943de8104c19d7ea5a540b02db8652b80ab54deed1e5848","node-v10.16.3-linux-arm64.tar.gz":"3bab16e7107092e43426e082ee9fd88ef0a43a35816f662f14563bcc5152600d","node-v10.16.3-linux-arm64.tar.xz":"8ee77bad022bd460bf2867a97bf56ce7ddc4aa2ace067e45995fb1721a958428","node-v10.16.3-linux-armv6l.tar.gz":"c4ce8f8627c4d0d71647987924e5369cd1adeef2865bf1bdbb4387b75fba804b","node-v10.16.3-linux-armv6l.tar.xz":"17b6ea87cde13c330a72c44be8a30ebebf83c7c71d1a1b92e1d629f273fa0743","node-v10.16.3-linux-armv7l.tar.gz":"f267710728ca56ca3b522076fff808540ea27d6aa5fd586bc0ad39c389530c3b","node-v10.16.3-linux-armv7l.tar.xz":"4a6f27308cd0cea136be6f5f7c194b0faabea016efe844fb1452c846d2eca7b1","node-v10.16.3-linux-ppc64le.tar.gz":"3e0f41b3cb991f062e1c93a297675af34d1a2f29052306cd585f1f5e25ea9159","node-v10.16.3-linux-ppc64le.tar.xz":"b51731b49f6816f5e3e670c399611eb9386f558cc2d597301fb73e585640a642","node-v10.16.3-linux-s390x.tar.gz":"ae87fa499fd5fd9d86d4f788cb4e54bd3eb4fdb735b20235537e9d38ae5da73b","node-v10.16.3-linux-s390x.tar.xz":"90cc57506c98cd5561f5dda9e103fa70083242fff2b1a39a5351fc15ff63db46","node-v10.16.3-linux-x64.tar.gz":"2f0397bb81c1d0c9901b9aff82a933257bf60f3992227b86107111a75b9030d9","node-v10.16.3-linux-x64.tar.xz":"d2271fd8cf997fa7447d638dfa92749ff18ca4b0d796bf89f2a82bf7800d5506","node-v10.16.3.pkg":"1c820559780c7a5b90ceebd819afce58f3c14805191141fbd59feb8485c2fc73","node-v10.16.3-sunos-x64.tar.gz":"d8f2418b748c4c9b1d8c1dc008b42384ca87c4c4c134df3a3009e6b7546f8b23","node-v10.16.3-sunos-x64.tar.xz":"2952da9d127c3f72fe5b3e466fbfe8a45ab3ef63263d881da7e9b586559f3693","node-v10.16.3.tar.gz":"db5a5e03a815b84a1266a4b48bb6a6d887175705f84fd2472f0d28e5e305a1f8","node-v10.16.3.tar.xz":"7bf1123d7415964775b8f81fe6ec6dd5c3c08abb42bb71dfe4409dbeeba26bbd","node-v10.16.3-win-x64.7z":"c2cc3b95d6e8504b20623cfe74f848d1ebc2f43a262e7bae14bee64db2b13889","node-v10.16.3-win-x64.zip":"19aa47de7c5950d7bd71a1e878013b98d93871cc311d7185f5472e6d3f633146","node-v10.16.3-win-x86.7z":"fc1ccb1e6f12fe68e816c552e6b1df289a8bfe064c025eb62c360bd041da4a5f","node-v10.16.3-win-x86.zip":"02a30a17c25c354747ac76fd130ff5495dde2f60f0a21ad675526951c2d7a52a","node-v10.16.3-x64.msi":"f68b75eea46232adb8fd38126c977dc244166d29e7c6cd2df930b460c38590a9","node-v10.16.3-x86.msi":"b3cf18ad447d177cf858dbe45751100846cad96ba7497cd7c1850a616758e67f","win-x64/node.exe":"cb8f5c1981e11a3d438b6867df5fb8e4f77cd29ddc0856d99b62060ef991c649","win-x64/node.lib":"9f10cd25d27fc31f8fe8f5fcc5e9f27a8ba5bb79dc0791dc0df102f063c0066e","win-x64/node_pdb.7z":"654d350ee101cbb4a0246e5226169f99af763a4d4c14546370ec6dfb09cf5a47","win-x64/node_pdb.zip":"426f326d88b5a184cc74ba50f5106eca933cb3386f872ffeb5844f3916296c09","win-x86/node.exe":"78b71fd2fb792c5f24848a05119d50d02407675a54a72caf0e40b039a43fefdd","win-x86/node.lib":"459095d9bd9dc4e2d12c4284e6fc5bdc78eec8181c8327c57876499b002a59fd","win-x86/node_pdb.7z":"1d0bb57a74e836835a1f9b8c1e0bf2493d4bd095c81a8e12d05cbfbf8c363534","win-x86/node_pdb.zip":"e2b5ea28cbe965e074e61035b559efda9312044ac5d0346243c041bbb62cea73"}
gyp http 200 https://nodejs.org/download/release/v10.16.3/win-x64/node.lib
gyp http 200 https://nodejs.org/download/release/v10.16.3/win-x86/node.lib
gyp verb content checksum win-x64/node.lib 9f10cd25d27fc31f8fe8f5fcc5e9f27a8ba5bb79dc0791dc0df102f063c0066e
gyp verb content checksum win-x86/node.lib 459095d9bd9dc4e2d12c4284e6fc5bdc78eec8181c8327c57876499b002a59fd
gyp verb download contents checksum {"node-v10.16.3-headers.tar.gz":"0901d1f1bfe0f5d922f9d79c5822a3624c11eb0f2de9fd552425bc98c7b95e54","win-x64/node.lib":"9f10cd25d27fc31f8fe8f5fcc5e9f27a8ba5bb79dc0791dc0df102f063c0066e","win-x86/node.lib":"459095d9bd9dc4e2d12c4284e6fc5bdc78eec8181c8327c57876499b002a59fd"}
gyp verb validating download checksum for node-v10.16.3-headers.tar.gz (0901d1f1bfe0f5d922f9d79c5822a3624c11eb0f2de9fd552425bc98c7b95e54 == 0901d1f1bfe0f5d922f9d79c5822a3624c11eb0f2de9fd552425bc98c7b95e54)
gyp verb validating download checksum for win-x64/node.lib (9f10cd25d27fc31f8fe8f5fcc5e9f27a8ba5bb79dc0791dc0df102f063c0066e == 9f10cd25d27fc31f8fe8f5fcc5e9f27a8ba5bb79dc0791dc0df102f063c0066e)
gyp verb validating download checksum for win-x86/node.lib (459095d9bd9dc4e2d12c4284e6fc5bdc78eec8181c8327c57876499b002a59fd == 459095d9bd9dc4e2d12c4284e6fc5bdc78eec8181c8327c57876499b002a59fd)
@richardlau
Copy link
Member

As observed the --tarball option doesn't currently work on Windows (see #1002). As a workaround you can extract the headers and use --nodedir to point to the extracted files.

As an aside, appmetrics should attempt to use prebuilt binaries on Windows if installed via npm install.

@joaocgreis
Copy link
Member

Fixed by #1926, thanks @s100!

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.

3 participants