I am working in Docker to containerize the Angular 5 application. This app uses node-sass 4.7.2. The application works fine in the Windows environment. During "npm install", it downloads the node-sass or builds the same using the sass-library-path defined in .npmrc file.
But, there are a lot of issues during the docker image creation process. It automatically tries to download binding.node file from https://github.com/sass/node-sass/releases/download/v4.7.2/linux-x64-72_binding.node But, there is no release for linux-x64-72. So, it downloads a dummy file(sized about 4KB) and throws "invalid ELF header" error.
If I specify some valid URL in sass-binary-path(https://github.com/sass/node-sass/releases/download/v4.7.2/linux-x64-59_binding.node), it throws "no module found" error.
I tried with npm rebuild node-sass
as well. I saw a lot of answers from the internet as well. Many of the answers suggested me to copy node-modules from the local environment. You know, this is never an option with Docker. I can't ask developers to commit node-modules also in the repository.
Is there any way to resolve this issue? or Is there any simple solution to solve it in the angular application like not using node-sass?
There was a node sass version specified in the package.json. For the corresponding node-sass version, there is no library available for the os linux-x64-72_binding.node. So, I upgraded the node-sass version in the package.json for which the Linux library was available.
Then, it downloaded the file without any issues.