简体   繁体   English

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

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

I like to install module AngularDevise ( https://github.com/cloudspace/angular_devise ) into an ionic project. 我喜欢将模块AngularDevise( https://github.com/cloudspace/angular_devise )安装到一个离子项目中。 But the module is not in the npm registry. 但是该模块不在npm注册表中。 So far I've tried several hints suggested in How to install a private NPM module without my own registry? 到目前为止,我已经尝试了如何在没有我自己的注册表的情况下安装私有NPM模块的一些提示 .

The following command 以下命令

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

seems to modify the package.json file: 似乎修改了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",

Still, I don't see any files from AngularDevise installed in the local project directory. 不过,我在本地项目目录中没有看到来自AngularDevise的任何文件。 What is the right way to install the *.js files locally? 在本地安装* .js文件的正确方法是什么?

Any suggestion is greatly appreciated. 任何建议,不胜感激。

Since I am not familiar with folder structure that ionic uses, please just use your own knowledge of where dependencies should go. 由于我不熟悉ionic使用的文件夹结构,因此请仅使用您自己对依赖关系的了解。

My suggestion would be to use git submodules , you can even put the project into node_modules folder and make an exception in your .gitignore to commit that folder (you only need an empty folder when working with submodules so .gitkeep will suffice). 我的建议是使用git子模块 ,您甚至可以将项目放入node_modules文件夹中,并在.gitignore中创建一个例外提交该文件夹(使用子模块时只需要一个空文件夹,这样.gitkeep就足够了)。

All you need to do then is update your submodules with a git command. 然后,您所需要做的就是使用git命令更新子模块。 It is an extra step but it works well when the module is not tracked by npm. 这是一个额外的步骤,但是当npm不跟踪该模块时,它会很好地工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM