Windows下RSSHub执行NPM i报错.md

背景

今天fork了一份RSSHub准备玩一下,发现 npm i的时候一直报错

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
node-pre-gyp WARN Using request for node-pre-gyp https download 
node-pre-gyp WARN Tried to download(404): https://github.com/BYVoid/OpenCC/releases/download/1.1.1/opencc-v1.1.1-node-v72-win32-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v72 ABI, unknown) (falling back to source compile with node-gyp)
gyp ERR! find VS
gyp ERR! find VS msvs_version not set from command line or npm config
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS checking VS2017 (15.9.28307.1321) found at:
gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools"
gyp ERR! find VS - found "Visual Studio C++ core features"
gyp ERR! find VS - found VC++ toolset: v141
gyp ERR! find VS - missing any Windows SDK
gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - not found
gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8

原因

在Windows下安装到一些库时,需要编译,所以要按相关环境

解决

  • 管理员打开 CMD
  • 运行 npm install --g --production windows-build-tools
    1
    2
    3
    4
    5
    6
    7
    8
    ---------- Visual Studio Build Tools ----------
    Successfully installed Visual Studio Build Tools.
    ------------------- Python --------------------
    Successfully installed Python 2.7

    Now configuring the Visual Studio Build Tools and Python...

    All done!
    成功

再次执行npm i就成功了

参考