gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-04 01:51:20 27 4
gpt4 key购买 nike

我希望为我的 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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com