安装node_modules常见错误及解决方案

一、环境变量找不到python与python2

需要安装与机器和npm适配的由Microsoft免费提供的Visual C ++ Build Tools 2017、.net framework 4.5.1、python2.7

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

如需安装Visual C ++ Build Tools 2015(节点7及以下版本所需),请使用windows-build-tools@1.4.2

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

二、找不到node-gyp模块

node程序中需要调用一些其他语言编写的 工具 或者dll,需要编译node-gyp解决跨平台问题,安装命令如下,如果不能解决,就重复一

npm install -g node-gyp

三、找不到node-sass模块

npm install node-sass@latest

四、phantomJS  not  found  on  PATH

npm install phantomjs-prebuilt@2.1.14 --ignore-scripts
原文地址:https://www.cnblogs.com/liuxuande/p/14004627.html