node.js - 无服务器框架下载模板时卡住

标签 node.js serverless-framework

我正在启动一个无服务器项目,在 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/

相关文章:

javascript - Node.js 的 REST API 无法同时向自身发出请求

node.js - 在 VS Code 的 NodeJS 应用程序的调试配置中运行 "npm start"

kotlin - AWS Lambda的意外行为

node.js - 连接池和 lambda 终止

amazon-dynamodb - 无服务器动态流和触发器

node.js - 如何在保存后进行 Mongoose 查询?

node.js - 检查服务器端是否存在 YouTube 视频

node.js - findUser 函数中的 Active Directory 错误

amazon-web-services - 无服务器 : Deploy Endpoint with Custom Authorizer - Name Not Found Error

node.js - 为什么无服务器 Node 8 函数在本地可以运行,但在 AWS 上却失败且没有错误消息?