-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
chore: fix lzma-native
build issues on Windows
#1191
Conversation
Have you created an issue against the Great to see the CI tests working again! |
npm-shrinkwrap.json
Outdated
"mute-stream": { | ||
"version": "0.0.5", | ||
"from": "mute-stream@0.0.5", | ||
"resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.5.tgz" | ||
}, | ||
"nan": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was concerned that some modules have been removed from the shrinkwrap, but it's actually just github's diff-display getting confused ;-)
...and when we next need to update the shrinkwrap file, how do we ensure that |
bf5044d
to
839ff07
Compare
We've been recently hitting a weird `lzma-native` build error on Windows (both locally and on Appveyor CI): ``` Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. build The input line is too long. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code 1. [C:\projects\etcher\node_modules\lzma-native\build\liblzma.vcxproj] ``` After a lot of experimentation, we realised the issue was gone if we removed `node-sass` from the development dependencies. The issue is that `node-gyp` was recently upgraded to v3.6.0, which was picked up by `node-sass`, which declares `node-gyp` as a dependency. For some reason, if `node-sass` causes `node-gyp` to be updated, then `lzma-native` fails with the above cryptic error. I was able to trace down the error to the following `node-gyp` commit: nodejs/node-gyp@ae141e1 As a solution, this commit starts to shrinkwrap development dependencies, and locks `node-gyp` to v3.5.0 until the issue is fixed. Fixes: addaleax/lzma-native#30 See: nodejs/node-gyp#1151 Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
839ff07
to
e3a4bd2
Compare
Good catch! Done!
I just tried to upgrade |
scripts/build/dependencies-npm.sh
Outdated
function run_install() { | ||
npm install $INSTALL_OPTS | ||
|
||
# Turns out that if `npm-shrinkwrap.json` contains development |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only a small nit, but could this comment be moved inside the if-block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
docs/CONTRIBUTING.md
Outdated
@@ -56,7 +56,7 @@ necessary dependencies get added is to run the following commands: | |||
```sh | |||
make electron-develop | |||
npm prune --production |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you also need to remove --production
from this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I"m removing this whole section, which described an approach to avoid development dependencies from being shrinkwrapped, which we are doing now.
scripts/clean-shrinkwrap.js
Outdated
@@ -25,7 +25,7 @@ const EXIT_CODES = require('../lib/shared/exit-codes'); | |||
const SHRINKWRAP_PATH = path.join(__dirname, '..', 'npm-shrinkwrap.json'); | |||
|
|||
try { | |||
console.log(childProcess.execSync('npm shrinkwrap', { | |||
console.log(childProcess.execSync('npm shrinkwrap --dev', { | |||
cwd: path.dirname(SHRINKWRAP_PATH) | |||
})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to change this to }).toString());
? Otherwise I just get <Buffer
and a load of hex-digits printed to the screen.
And I think this script might need to be using npm prune
too? In fact, could the CONTRIBUTING.md
instructions be updated to use only this script (even if that means modifications are needed to this script also), as currently it's unclear in the instructions when to use npm run clean-shrinkwrap
and when to use npm shrinkwrap --dev
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...and when I run this on my local machine (which currently has npm 3.10.10) it adds a load of "dev": true
entries into my npm-shrinkwrap.json
, which aren't in the shrinkwrap file in this PR? :-/
e.g.
diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json
index 5556a28..f7916e9 100644
--- a/npm-shrinkwrap.json
+++ b/npm-shrinkwrap.json
@@ -5,61 +5,72 @@
"abbrev": {
"version": "1.1.0",
"from": "abbrev@>=1.0.0 <2.0.0",
- "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.0.tgz"
+ "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.0.tgz",
+ "dev": true
},
"acorn": {
"version": "4.0.11",
"from": "acorn@>=4.0.3 <5.0.0",
- "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.11.tgz"
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.11.tgz",
+ "dev": true
},
"acorn-jsx": {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding this scripts, I think the complexity of this script lies in the fact that it call npm shrinkwrap
itself, when its not really its responsibility. Now that we're shrinkwrapping development dependencies, we shouldn't need to call npm shrinkwrap
ourselves (npm will do it automatically for us whenever we do npm install
, npm uninstall
, etc).
I edited the script to only scans the current shrinkwrap file and remove the optional dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding the dev: true
properties, it seems that they are being added by a new npm version (mine is a bit older than yours). I'll upgrade and get those changes added here.
Sounds like a job for another CI bash script. Give me 10 minutes... ;-) |
...I've added |
Amazing stuff! :D |
@lurch Updated! |
Hello from nodejs/node-gyp#1151,
I'm working on a better workflow, but till then you'll need to setup VC Vars... |
Hi @refack , Thanks for reaching out.
Correct me if I'm wrong (I'm not a Windows expert), but this means that we should run
We were using pre-build binaries at some point, but decided to build ourselves after hitting an ABI issue after an electron upgrade (better to make sure they are always on sync by compiling ourselves) |
Sorry, I was too hasty. it's not a |
Btw, earlier versions of the library also have pre-buit binaries available. But fwiw, if there’s any help I can offer by providing more pre-built binaries, I’m glad to look into that. (It would be really cool to know which electron versions to look out for in that case, though.) |
Hi @addaleax Thank you very much the good will. If you want to ensure In any case, I don't think its reasonable for you to invest time into that. Compiling the module just takes a few seconds from our side, and allows you to not have to worry about being on top of nodejs releases all the time. |
scripts/build/dependencies-npm.sh
Outdated
if [ "$ARGV_PRODUCTION" == "true" ]; then | ||
|
||
# Turns out that if `npm-shrinkwrap.json` contains development | ||
# dependencies then `npm install --production` will also install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this comment imply that when "$ARGV_PRODUCTION" == "true"
we ought to be adding --production
to $INSTALL_OPTS
?
(I guess there's a slim chance that npm install --production
might get fixed in future, and in that case npm install --production; npm prune --production
will probably be quicker than npm install; npm prune --production
?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean that when doing npm install --production
, npm will also install the development dependencies (I know, npm is messed :P), which is the reason why we just do npm install
+ npm prune --production
.
(I guess there's a slim chance that npm install --production might get fixed in future, and in that case npm install --production; npm prune --production will probably be quicker than npm install; npm prune --production?)
Fair enough. Lets add it in case it gets fixed in the future :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
docs/CONTRIBUTING.md
Outdated
npm prune --production | ||
npm shrinkwrap --dev | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, much cleaner 👍
OTOH if pre-compiled versions of |
@lurch We will have various more native dependencies very soon:
so I wouldn't try to remove the Visual Studio dependency. |
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
902189a
to
1026b15
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 😄
Amazing stuff, thanks a lot @refack ! Do you mind letting us know when you release a new version, so we can upgrade to it? |
This doesn't appear to be an issue anymore. Connects To: #1191
This doesn't appear to be an issue anymore. Connects To: #1191
This doesn't appear to be an issue anymore. Connects To: #1191
We've been recently hitting a weird
lzma-native
build error on Windows(both locally and on Appveyor CI):
After a lot of experimentation, we realised the issue was gone if we
removed
node-sass
from the development dependencies.The issue is that
node-gyp
was recently upgraded to v3.6.0, which waspicked up by
node-sass
, which declaresnode-gyp
as a dependency. Forsome reason, if
node-sass
causesnode-gyp
to be updated, thenlzma-native
fails with the above cryptic error.I was able to trace down the error to the following
node-gyp
commit:nodejs/node-gyp@ae141e1
As a solution, this commit starts to shrinkwrap development
dependencies, and locks
node-gyp
to v3.5.0 until the issue is fixed.Fixes: addaleax/lzma-native#30
See: nodejs/node-gyp#1151
Signed-off-by: Juan Cruz Viotti jviotti@openmailbox.org