When you see the logs for Cannot download node-sass issue it might have the below error
HTTP error 404 Not Found
When issuing the npm install command, if the node-sass is not compatible with your version of node-sass this error will occur. When it is not compatible, It will try to download from GitHub and will result in this 404 error.
Error Logs
Downloading binary from https://github.com/sass/node-sass/releases/download/v4.10.0/win32-x64-72_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.10.0/win32-x64-72_binding.node":
HTTP error 404 Not Found
Hint: If github.com is
not accessible in your location
try setting a proxy via HTTP_PROXY, e.g.
export HTTP_PROXY=http://example.com:1234
or configure npm proxy via
npm config set proxy http://example.com:8080
gyp ERR!
System Windows_NT 10.0.17763
gyp ERR! node -v v12.19.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN optional
SKIPPING OPTIONAL DEPENDENCY: node-sass@4.10.0 (node_modules\@angular-devkit\build-angular\node_modules\node-sass):
npm WARN optional
SKIPPING OPTIONAL DEPENDENCY: node-sass@4.10.0 postinstall: `node scripts/build.js`
npm WARN optional
SKIPPING OPTIONAL DEPENDENCY: Exit status 1
added 1366 packages from 1197 contributors and audited 1385 packages in 563.133s
28 packages are looking for funding
run `npm fund` for details
found 44 vulnerabilities (25 low, 3 moderate, 16 high)
run `npm audit fix` to fix them, or `npm audit` for details
Try any of the following solutions.
Solution 1
The above problem occurs for me in Nodejs 12 as node-sass 4.10.0 is not compatible with Nodejs 12. To resolve this, install node-sass separately using the following command
To install specific version
npm i node-sass@4.12.0
Again I got the same error, but node sass is installed. If you see the logs like below the node-sass might be installed.
npm WARN optional
SKIPPING OPTIONAL DEPENDENCY: node-sass@4.10.0 postinstall: `node scripts/build.js`
npm WARN optional
SKIPPING OPTIONAL DEPENDENCY: Exit status 1
+ node-sass@4.12.0
added 25 packages from 6 contributors and audited 1456 packages in 30.60s
To install the latest version,
npm install node-sass or npm i node-sass
but make sure the latest version is compatible with your nodejs
If you installed lower versions or higher versions uninstall, clean cache and proceed,
npm uninstall node-sass
npm cache clean -f
where f stands for force
To see the compatible nodejs version of node-sass visit,
https://github.com/sass/node-sass or
https://www.npmjs.com/package/node-sass
Solution 2
Run command prompt with admin privileges.
Solution 3
Try with proxy.
npm config set proxy “http://proxy.yourorgname.com:proxy-port”
npm config set https-proxy “http://proxy.yourorgname.com:proxy-port”