node-sass installation issue

2019-02-14 20:12发布

When I try to install node-sass using npm, I get the following error message:

Cannot download "https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-57_binding.node":"

The command I use is:

npm install node-sass --save-dev-

You can see more details in the screenshot below:

installation process

6条回答
不美不萌又怎样
2楼-- · 2019-02-14 20:44

After struggling , finally found exact solution. In node js software folder, node-sass\4.5.0 folder is still created in npm-cache folder. So I download win32-x64-48_binding.node manually, put it in C:\Users\Administrator\AppData\Roaming\npm-cache\node-sass\4.5.0 folder.

And run npm install command, issue resolved.

查看更多
叼着烟拽天下
3楼-- · 2019-02-14 20:59

Depends on which node version you are using. Node-Sass currently supports only these versions:

Supported Node.js versions 0.10, 0.12, 1, 2, 3, 4, 5, 6 and 7.

If you happen to work on one of those versions, try to specify which version of node-sass you want:

$ npm install --save-dev node-sass@4.5.3

your npm is trying to download node-sass version 3.31.1 which is does not exist on the releases page of https://github.com/sass/node-sass/releases

查看更多
走好不送
4楼-- · 2019-02-14 21:01

None of the above solutions worked for me, this is what I did:

Installed C++ build tools for Visual Studio

Then:

npm uninstall --save-dev gulp-sass
查看更多
太酷不给撩
5楼-- · 2019-02-14 21:02

While searching for the solution, have checked the release versions of node-sass and found that "https://github.com/sass/node-sass/releases" the node file it was looking is committed in the latest release and not in the older version. After downloading the required file "win32-x64-64_binding.node" manually from the released version and placing it under C:\Users\Administrator\AppData\Roaming\npm-cache\node-sass\4.7.2 or simply by using npm install node-sass@latest works for me.

查看更多
霸刀☆藐视天下
6楼-- · 2019-02-14 21:06

You have an error on your command:

$ npm install node-sass --save-dev-
                                 ^^^

Should be

$ npm install node-sass --save-dev

(without the last - on dev)

Also, it is giving you a WARNING because it wants to be installed globally.

See the official node-sass documentation.

And also, could be interesting for you to know the differences between --save and --save-dev.

查看更多
smile是对你的礼貌
7楼-- · 2019-02-14 21:08

I see you are running node version 8.1.4. You can also check it using node --version in the command prompt.

You'll have to use a version >= v4.5.3 instead because lower versions of node-sass are incompatible with node8. This issue has been reported on their GitHub issue page. You either have to define using v4.5.3 instead or pass the the -g parameter while installing it, which seems to fetch the latest version automagically.

when i used -g it worked properly and got the latest version

Also, as @javiergarval has pointed out, you have a typo. It should have been --save-dev instead of --save-dev-.

查看更多
登录 后发表回答