3

Problem Description?

implement

npm i node-sass -D

Keyword description:

tunneling socket could not be established, cause=getaddrinfo ENOTFOUND 49402 // 这个端口号每个人出现的可能不一样
Error: Could not find any Python installation to use ...

Figure description

If you encounter these problems, you should be able to find the answers here

The final error message

Why is there a Python prompt reporting an error

Reason: It prompts that python is not installed and the build fails. If the binding.node fails to be pulled, node-sass will try to compile binding.node locally, and the process needs python

Why does the download fail

When executing npm install node-sass , the console will see that win32-x64-72_binding.node is being downloaded from github. This is a binary file and does not exist in the npm repository. It is downloaded directly from github. The download is very slow. If there is no wall, it fails. Will be more likely

5 ways to solve slow downloading

  1. All dependencies are set to Taobao mirror

    npm config set registry https://registry.npm.taobao.org/
  2. Only set the pull address for node-sass

    npm install node-sass --sass-binary-site=https://npm.taobao.org/mirrors/node-sass

    3. Set in npm config

    npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass

    4. In package.json

    "nodeSassConfig": {
        "binarySite": "https://npm.taobao.org/mirrors/node-sass"
    },

    5. Create a new .npmrc file in the project directory

    registry=https://registry.npm.taobao.org/
    # 设置私有服
    @pm:registry=http://192.168.1.200:8081/repository/npm/
    # 比如安装
    npm install @pm/axios -S
    npm install @pm/vue -S

The above is not resolved, solve the port number problem

What my computer reports is: 49402

View npm configuration

npm config list -l // 查看npm所有配置

Check whether there is a proxy field in it, if any, delete it

npm config delete proxy
npm config delete https-proxy

Check environment variables

Found a 49402 port here, delete it

🐱 After clearing the environment variables, note that the computer restarts once

After restart

After doing the above checks or configurations here, I have solved the node-sass installation problem

add

Download file to local method

current verification fails

Is to start with https://npm.taobao.org/mirrors/node-sass ,
Select a node-sass version to download first, and then in the local npm chche directory, such as the directory of my computer

C:\Users\YXS\AppData\Roaming\npm-cache\node-sass

Then set

npm config set sass-binary-site C:/Users/YXS/AppData/Roaming/npm-cache/node-sass
# 查看是否生效
npm config list -l

Then install

npm i node-sass@4.10.0 -D

Windows operating system

Administrator rights execute the following commands

npm install --global --production windows-build-tools

current verification fails

Temporary CMD Agent

In the future, if you need to temporarily set up a proxy for cmd, you can use the following command line. This environment variable will only last until the cmd window is closed, not a system environment variable

set http_proxy=http://127.0.0.1:1080
set https_proxy=http://127.0.0.1:1080

More useful knowledge

https://blog.csdn.net/weixin_38384296/article/details/116403848


羊先生
1.9k 声望821 粉丝