-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Why does node-sass downloads\builds the binding on each npm install? #654
Comments
Hi, Q. Why does node-sass downloads\builds the binding on each npm install? Preciseness & Bandwidth-friendliness: Each platform (Mac, Linux etc.) has its own binary for each architecture (x86-64, x86-32), so instead of downloading everything on your system, this way we detect your system in our post install script and download the matching binary from a separate repo: https://github.com/sass/node-sass-binaries. Q. Is this the best way? npm package is a distilled form, we cannot modify or make decisions at install time to cherry pick constituents of package. We used to bundle binaries in npm sometime ago. We realised this approach is better due to the aforementioned reason. Q. What is the other option? Download all binaries, and delete them except the one which is suitable for your system. This approach is non-bandwidth-friendly. Related: #655. |
First of all, great answer. The optimal solution i see for me is to have a local copy of binding.node (in the version i need) and copy it to the appropriate place right after 'npm install' is ran. |
Implicitly yes. |
Cool, many thanks! |
@am11 Hey, |
Hej @janusch, Run: # in CLI
node -p "[process.platform, '-', process.arch, '-', process.versions.modules].join('')" and note its output. If you have a subdirectory with that name under |
@am11 thank you for getting back to me! Here is the output from from the command above: test_i$ node -p "[process.platform, '-', process.arch, '-', process.versions.modules].join('')"
linux-x64-46 I think I realized what went wrong, the vendor dir is not included when I |
@am11 Hey, Would it make more sense to go for plan B and install a libsass linux package instead and node-sass can skip installing any binaries? Thank you again for taking the time to walk me through this! |
I believe this is fixed on master. We'll be releasing 3.5.0 stable in a
|
@xzyfer sorry. I used this issue for my own problem with not being able to download binaries due to no internet connection. I think i just figured it out. Just had to add the "files": [
"bin",
"binding.gyp",
"lib",
"scripts",
"vendor",
"src"
] Sorry again for putting this into an issue that was meant for something else, I had lost track. |
Hey @am11 @xzyfer , I had to pull in the libsass git submodule. Now it builds but I am not sure what should go into the patched node-sass package that is fully standalone. Could you point me to a guide that helps with builiding a standalone node-sass package. Could you please give me an example of the SASS_BINARY_PATH for when the binaries are within the node_modules/node-sass/vendor dir? How can building libsass be skipped, or do I need to add the git submodule to the package? Would be delighted if we get this to work! edit. Here is the npm-debug info that could be relevant: Error: node-sass@10.4.2 postinstall: `node scripts/build.js`
Exit status 1
at EventEmitter.<anonymous> (/usr/share/npm/lib/utils/lifecycle.js:232:16)
at EventEmitter.emit (events.js:98:17)
at ChildProcess.<anonymous> (/usr/share/npm/lib/utils/spawn.js:24:14)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:766:16)
at Process.ChildProcess._handle.onexit (child_process.js:833:5) |
Are you trying to install node-sass offline with git source? If so, you would need to have the repo cloned recursively to pull the libsass submodule: |
@am11 great, this fixed it! |
Add support for numbers as map keys
Hi,
I have a problem where we just integrated node-sass, on our CI machines, each build calls npm install which redownloads the binding file. I saw the option to suppress the download and let python build the binding for me, but my question is why can't the binding be downloaded as part of the package?
The text was updated successfully, but these errors were encountered: