node.js - 无需 npm 手动安装 Angular 5 模块

标签 node.js angular npm angular5 npm-install

我希望为我的 Angular 项目手动安装 npm 模块。我位于代理后面,而不是为我的 npm 配置文件设置代理信息,我只想手动下载 npm 模块并将它们添加到我的 npm-cache/node_modules 文件夹中。

我看过这篇旧文章,但没有找到更新的内容:How to install a node.js module without using npm?

我想要安装的模块之一是 ng2-signalr。我访问 GitHub,下载了该包的源代码,并将其添加到我的 node_modules 文件夹中。

完成此操作后,我可以毫无错误地导入模块:

import { SignalRConfiguration } from 'ng2-signalr';

当我添加使用该类的代码时:

const c = new SignalRConfiguration();

我收到以下错误:

index.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.

我是否缺少手动安装 Node 模块的步骤?我应该下载到我的 npm 缓存文件夹吗?

我知道我必须注意这些手动安装的模块的依赖关系。我还知道,当您需要重新安装时,缓存文件夹会被覆盖,并且由于大小原因,当您 checkin 源时,通常不会包含 node_modules 文件夹,但我只想尝试一下该库。

有什么建议吗?

最佳答案

添加您希望在 Typescript 配置中使用的目录或索引文件。 tsconfig.app.json 中的示例:

"include": [
    "../path/to/library"
]

此后重建。这可能是由于第 3 方未正确设置 package.json

关于node.js - 无需 npm 手动安装 Angular 5 模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49558447/

相关文章:

javascript - browserify无法调用我捆绑的函数,它没有定义

javascript - NodeJS nTwitter 演示

javascript - 如何以编程方式为询问者的答案设置选定值

node.js - npm Bower 安装失败(卡在同一位置)

angular - Angular 应用程序如何运行?哪个文件先执行?

node.js - npm install 命令 - 请解释一下

node.js - 从同一文件 node.js 访问另一个 module.exports 函数

javascript - nginx服务器和node.js运行故障

angular - 动态渲染组件

node.js - 为什么当我运行 Angular/React 项目时它无法在我的本地主机上运行?