我正在启动一个无服务器项目,在 Windows 上学习它,使用 npm 安装它,在 PowerShell 上运行 serverless
,选择 aws-node-express-dynamodb-api
模板,问题是,它永远停留在 正在下载 aws-node-express-dynamodb-api 模板...
永远不会完成它或实际下载任何内容,安装中唯一的错误是以下:
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 could not use PowerShell to find Visual Studio 2017 or newer
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
gyp ERR! find VS
gyp ERR! find VS **************************************************************
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the "Desktop development with C++" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
gyp ERR! find VS **************************************************************
它似乎正在尝试配置 Visual Studio,但我并不担心,因为我不使用它。
最佳答案
我的修复方法是卸载 serverless
并使用不同版本的 Node.js 重新安装。安装无服务器时查找 npm 警告。例如,
$ npm install -g serverless
npm WARN npm npm does not support Node.js v14.0.0
...
以下版本对我有用:node v15.0.1。您可以使用 Node Version Manager 下载并安装特定版本的 Node .
$ nvm use 15.0.1
Now using node v15.0.1 (npm v7.0.3)
或者,尝试不同的安装方法:https://serverless.com/install
关于node.js - 无服务器框架下载模板时卡住,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69500335/