I'm building a build task for Visual Studio Team Services. In this task I'm using 7zip-bin
to package the binary for 7zip for linux, mac and windows.
This is all nice and it would work if I had the ability to deploy just the package.json to the build server, but no... A build task contains all its dependencies at build time.
Is there a way I can force npm to download all OS optional packages somehow? Or will I have to download the file myself during build and extract it?
Right now I'm using
npm install 7zip-bin --save
Which results in:
C:\temp>npm install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: 7zip-bin-linux@^1.0.3 (node_modules\7zip-bin\node_modules\7zip-bin-linux):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"linux","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: 7zip-bin-mac@^1.0.1 (node_modules\7zip-bin\node_modules\7zip-bin-mac):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
installing each optional package directly isn't possible, when I run
npm install 7zip-bin-linux --save
on a windows machine, the install is skipped and I get a EBADPLATFORM error.
I understand I can't run these on my machine, but I need to package them in a vsix
file (a glorified zip) so I can use them when my build task is running on these other platforms.
You should depend on these 3 optional packages, because you never know if 7zip-bin
will change it's optional dependencies, which you are using directly.
For example:
dependencies: {
"7zip-bin-mac": "^1.0.1",
"7zip-bin-win": "^2.0.2",
"7zip-bin-linux": "^1.0.3"
}
Using either way, you need to run npm install -f
to force the installation.