【问题标题】:Finding out npm version from package-lock.json从 package-lock.json 中找出 npm 版本
【发布时间】:2022-09-26 16:30:49
【问题描述】:

我有一个使用未知节点和 npm 版本构建的节点应用程序。有没有办法从package-lock.json 猜测版本,或者至少是一个版本范围?

我确实有\"lockfileVersion\": 1,,这意味着 npm v5 或 v6。有什么办法可以得到更多的粒度?

我需要它的原因是,我在运行ts-node 时遇到了一堆这样的错误,除非我删除并重建package-lock.json。出于各种原因,我宁愿不这样做。

      ts.Debug.assert(typeof typeReferenceDirectiveName === \"string\", \"Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself.\");
  • 你有没有找到解决方案?
  • 没有。如果我真的想过火,我会在一个循环中编写一个具有不同 nvm 版本的脚本。

标签: node.js npm ts-node


【解决方案1】:

只需在 package.json 中搜索“@types/node”。它会给你使用的节点版本。现在搜索节点版本安装的相对 npm 版本。

"@types/node": {
      "version": "16.9.4",
      "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.4.tgz",
      "integrity": "sha512-KDazLNYAGIuJugdbULwFZULF9qQ13yNWEBFnfVpql......",
      "dev": true
    },

【讨论】:

    猜你喜欢
    • 2021-05-14
    • 1970-01-01
    • 1970-01-01
    • 2021-09-16
    • 1970-01-01
    • 1970-01-01
    • 2022-01-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多