如何将模块(不在 npm 注册表中)安装到离子项目?

How to install a module (not in the npm registry) to an ionic project?

我喜欢安装模块 AngularDevise (https://github.com/cloudspace/angular_devise) into an ionic project. But the module is not in the npm registry. So far I've tried several hints suggested in How to install a private NPM module without my own registry?.

以下命令

npm install -S "https://github.com/cloudspace/angular_devise.git"

似乎修改了 package.json 文件:

diff --git a/mobile/package.json b/mobile/package.json
@@ -3,11 +3,12 @@
   "version": "1.1.1",
   "description": "mobile: An Ionic project",
   "dependencies": {
+    "AngularDevise": "git+https://github.com/cloudspace/angular_devise.git",
     "gulp": "^3.5.6",

仍然,我没有看到任何来自 AngularDevise 的文件安装在本地项目目录中。在本地安装 *.js 文件的正确方法是什么?

非常感谢任何建议。

由于我不熟悉 ionic 使用的文件夹结构,请使用您自己的知识了解依赖项应该放在哪里。

我的建议是使用 git submodules,您甚至可以将项目放入 node_modules 文件夹并在您的 .git 忽略提交该文件夹(您只使用子模块时需要一个空文件夹,所以 .gitkeep 就足够了)。

然后您需要做的就是使用 git 命令更新您的子模块。这是一个额外的步骤,但当模块未被 npm 跟踪时,它运行良好。