npm命令使用

更新一下npm
npm cache clean -f(如果遇到提示npm WARN using --force Recommended protections disabled,需要降低npm版本,使用命令npm install [email protected] -g )
npm install npm -g

查看已安装
npm list

我查看到关键词是“node-gyp",于是我以系统管理员身份,打开cmd,

为node-gyp配置安装python2.7以及VC++ build Tools依赖
cmd输入以下命令

npm install --global node-gyp@latest
npm install --global --production windows-build-tools
配置依赖
  cmd输入以下命令

  npm config set python C:\Users\zhangwei3\.windows-build-tools\python27\python.exe
  npm config set msbuild_path C:\Users\zhangwei3\.windows-build-tools\vs_BuildTools.exe

python配置环境变量

    (1) 右键点击"计算机",然后点击"属性"

    (2) 然后点击"高级系统设置"

  (3) 选择"系统变量"窗口下面的"Path",双击即可!

  (4) 然后在"Path"行,添加python安装路径即可(我的C:\Users\dida\.windows-build-tools\python27)。

    此时cmd输入python,可查看到版本号,说明安装成功

你可能感兴趣的:(npm命令使用)