node-sass gravesites record

node-sass gravesites record

background

The original project, the environment:

node: v8.16.2

Elevation: v6.4.1

node-sass::v4.8.0

Angular-CLI:v6.x

This machine is not installed Visual Studio

These are related to the version of the tool can be used normally, well-run project.

Later, the new project took over in:

Angular-CLI:v8.x

Because Angular upgraded version also upgraded Angular-CLI version, resulting in v8.x version of the node has been unable to compile angular project, at least need to use node v10.x version.

Helpless, the node upgrade version, and was followed by node-sass v4.8.0 version can not be used, has led to the build to fail, so they have to install a new version node-sass.

But the new version node-sass installation process but can not find Python environment report errors, leading to install failed.

Finally locally installed Python environment, but also reported a MSB4132: Tools version 2.0 does not recognize the error.

Check in online for a long time, follow the change, but the new MSB4019 error occurs: Microsoft.Cpp.Default.props not found error.

Find the next, because the machine does not find VS C ++ editing tools, you can help:

npm install -g --production windows.build.tools

To download and install, tried, found that networking is required for the job, not the office network outside the network.

Official website saw a long time to find a way to download the offline installation package, the result is the 2019 version, too new, the project is still being given.

(what the fuck!

Related abnormalities

  • error MSB4019
gyp info spawn xxx
error MSB4019:未找到导入的项目 "E:\Microsoft.Cpp.Default.props"。请确认 <Import> 声明中的路径正确,且磁盘上存在该文件

gyp ERR! stack Error `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
  • error MSB4132
gyp verb Not using VS2017: Could not use PowerShell to find VS2017
...
gyp verb could not find "msbuild.exe" in PATH - finding location in registry
...
MSBUILD : error MSB4132: 无法识别工具版本“2.0”。可用的工具版本为 "4.0"。
  • python not found
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
  • a bug in node-gyp
gyp ERR! This is a bug in `node-gyp`.
gyp ERR! Try to update node-gyp and file an Issue if it does not help

analysis

After all, it is because the office network is limited to access the Internet leads.

After all, a big upgrade version angular, followed by a number of dependent libraries also need to follow the upgrade, which is understandable, understandable, so when I upgrade node-sass when I was nothing objectionable.

But who knows, node-sass to download the new version of the need to rely on C ++ compiler environment, need to rely on python environment, although here a little annoying, but fortunately, the Internet is also a lot of people has this problem, the solution is not difficult, as follows:

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

windows-build-tools introduction can look at the official website:

https://www.npmjs.com/package/windows-build-tools

This command is, in fact, will automatically go to networking Visual C ++ Build Tools Download and install Python 2.7 environment, one-button commands.

But, my office network can not access external networks ah!

Although there Npm warehouse within the network, but only download windows-build-tools package, this package is a bunch of scripts to access the Internet to download stuff, ah, for me, this solution is useless ah!

Helpless, our only installation, Python Fortunately, Web search, installation + configuration environment variable.

The problem is that Visual C ++ Build Tools, the Mircosoft things, engage in off-line installation, it is really in trouble.

Here are the official tutorial (though they do not understand how), as well as chiefs of online tutorials, links are posted, I am here to talk about, interest, self-review:

summary

The reason why normal, new projects before problems arise because of the environment of each version upgrade, so need to be clear, each environment, there are dependencies between the frames, not any version can be combined, such as:

angular v8 version need to rely on angular-cli v8.x version;

angular-cli v8.x version need to rely on node v10.x version;

node-sass v4.8 only supports node v9 version;

So, when you need to upgrade angular version, please pay attention to these matters, specific dependencies, go to their official website for instructions.

solution

Can be networked

  1. First upgrade angular version, upgrade version angular-cli
  2. When the build fails, you are prompted to upgrade node version, follow the prompts to upgrade, you can download the new version node or manually by nvm
  3. To build, node-sass download failed
    1. Please confirm whether the problem is a mirror, you can manually in the browser address bar enter the address of node-sass Download (viewable in package.json.lock in), see if you can find the corresponding version of node-sass
    2. When several node-sass compilation error occurs beginning of the article said, pay attention to the log, depending on the error, search for relevant keywords, according to online tutorials to solve, in general, is not python environment, no c ++ compiler tools, vs high version and other issues , you can try by npm install windows-build-tools to automatically download and install these tools a try

Recommendations related more to the issue github repository where to look, you can usually find the problem encountered

Not networking

Office network can not access external networks, but will have their own internal image storage, so download basic node like the library is no problem, to solve the above steps can refer to the same execution.

You can not access the Internet the most important thing is, windows can not download things, such as the above windows-build-tools to automatically download vs c ++ compiler tool will not download.

At this time, if necessary, it can only be on the machine can access the external network, the first thing associated vs studio download, install and then offline.

In fact, I ended up even after the vs studio 2019 version of the offline installation, node-sass still or download fails, finally, there is really no time to study, and just in access to loom above the external network, also installed node with the version, and then after a successful download a good node-sass, this node-sass packets directly to the office copy machine used above.

Reference links

The following are lots and lots of links, some have proposed solutions, some do not, and seeking:

Guess you like

Origin www.cnblogs.com/dasusu/p/11872852.html