【问题标题】:How set version for serverless project?如何为无服务器项目设置版本?
【发布时间】:2020-02-03 11:28:45
【问题描述】:

我已通过npm install -g serverless@1.38.0 命令将无服务器降级为1.38.0 版本。在具有以下 package.json 的文件夹上调用 npm install

{
  "name": "serverless-defaults",
  "version": "1.6.0",
  "description": "description",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/???"
  },
  "bugs": {
    "url": "https://github.com/???"
  },
  "homepage": "https://github.com/???#readme",
  "license": "MIT",
  "private": true,
  "devDependencies": {
    "serverless-cf-vars": "^0.3.2",
    "serverless-domain-manager": "3.2.7",
    "serverless-pseudo-parameters": "^2.4.0",
    "serverless-step-functions": "^2.6.0"
  }
}

得到:

cmd.exe /c "npm install"
npm WARN deprecated superagent@3.8.3: Please note that v5.0.1+ of superagent removes User-Agent header by default, therefore you may need to add it yourself (e.g. GitHub blocks requests without a User-Agent header).  This notice will go away with v5.0.2+ once it is released.

> spawn-sync@1.0.15 postinstall C:\pah\node_modules\spawn-sync
> node postinstall


> jsonpath@1.0.2 postinstall C:\pah\node_modules\jsonpath
> node lib/aesprim.js > generated/aesprim-browser.js


> serverless@1.53.0 postinstall C:\pah\node_modules\serverless
> node ./scripts/postinstall.js

 +--------------------------------------------------+
 |                                                  |
 |  Serverless Framework successfully installed!    |
 |  To start your first project, run “serverless”.  |
 |                                                  |
 +--------------------------------------------------+

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.0 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.0: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

added 592 packages from 368 contributors and audited 1848 packages in 32.798s
found 0 vulnerabilities


Process finished with exit code 0

为什么serverless@1.53.0 会出现在日志中??? npm 哪里有最后一个无服务器版本???在哪里指定我需要的无服务器版本?

【问题讨论】:

    标签: javascript node.js json npm serverless-framework


    【解决方案1】:

    serverless-step-functions depends directly 在无服务器框架上。我的猜测是它正在解析为最新的兼容版本。

    尝试在您的 package.json 中添加一个新条目:

    "dependencies": {
      "serverless": "1.38.0"
    }
    

    这应该确保serverless-step-functions 不会安装更新版本的框架。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-03
      • 2015-01-29
      • 2021-05-23
      • 1970-01-01
      • 1970-01-01
      • 2019-09-03
      相关资源
      最近更新 更多