【问题标题】:How to manage a non-node module as dependency for Node Project thorugh NPM?如何通过 NPM 管理非节点模块作为 Node Project 的依赖项?
【发布时间】:2020-04-15 09:05:03
【问题描述】:

我在我的项目中使用 bower 进行依赖管理。但现在我想转向 node 和 npm。但问题是我的依赖很少不是像Smooth-Div-Scroll1swiftype-search-jquery2这样的节点模块

如何在我的节点项目中管理所有这些依赖项。当我尝试做

"swiftype-search-jquery": "git@github.com:swiftype/swiftype-search-jquery.git",
"smooth-div-scroll": "git@github.com:tkahn/Smooth-Div-Scroll.git",

无法下载依赖并抛出错误

npm ERR! code ENOPACKAGEJSON npm ERR! package.json Non-registry package missing package.json: swiftype-search-jquery@git+ssh://git@github.com/swiftype/swiftype-search-jquery.git. npm ERR! package.json npm can't find a package.json file in your current directory.

这些依赖项的文件夹中没有 package.json。

【问题讨论】:

    标签: npm bower dependency-management


    【解决方案1】:

    我认为这是不可能的。 这是从 bower 迁移到 npm 的指南,非常简单。

    https://codecraft.tv/courses/angularjs-migration/step-2-typescript-and-webpack/converting-bower-to-npm/

    【讨论】:

      【解决方案2】:

      是的,使用 NPM 是不可能的,但与此同时,使用 Yarn 是可能的,无需进行任何更改。我们必须使用“yarn install”而不是“npm install”。

      使用 NPM 不存在的 git url 添加依赖项。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2010-11-15
        • 2016-12-08
        • 1970-01-01
        • 2021-05-23
        • 1970-01-01
        • 1970-01-01
        • 2019-12-03
        • 1970-01-01
        相关资源
        最近更新 更多