npm安装github repo strip src文件夹 [英] npm install github repo strips src folder

查看:181
本文介绍了npm安装github repo strip src文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了以下事情:

  npm install TuningGuide / react-sortable-hoc --save 
npm info它工作,如果它结束与确定
npm信息使用npm@3.10.5
npm信息使用node@v6.2.2
npm信息git ['clone',
npm info git '--template = / Users / velten / .npm / _git-remotes / _templates',
npm info git'--mirror',
npm info git'git://github.com/tuningguide /react-sortable-hoc.git',
npm info git'/Users/velten/.npm/_git-remotes/git-github-com-tuningguide-react-sortable-hoc-git-78a804e9']
npm info git ['rev-list','-n1','master']
npm info git ['clone',
npm info git'/Users/velten/.npm/ _git-remotes / git-github-com-tuningguide-react-sortable-hoc-git-78a804e9',
npm info git'/ var / folders / 95 / ylk5ht9s24n6xk4rcr6sch4r0000gn / T / npm-22395-24e6f9cc / git- cache-220f34bb / 09fb1e0c7d657657b9aa091c018b45aee0ed0662']
npm info git ['checkout','09fb1e0c7d657657b9aa091c018b45aee0ed0 662']
npm info git ['submodule','-q','update','--init','--recursive']
npm info尝试注册表请求14 :18:51
npm http请求GET https://registry.npmjs.org/invariant
npm http 304 https://registry.npmjs.org/invariant
npm info生命周期不变@ 2.2.1〜preinstall:invariant@2.2.1
npm info生命周期react-sortable-hoc@0.0.7~preinstall:react-sortable-hoc@0.0.7
npm info linkStuff invariant@2.2。 1
npm info linkStuff react-sortable-hoc@0.0.7
npm info生命周期invariant@2.2.1~install:invariant@2.2.1
npm info生命周期react-sortable-hoc @ 0.0.7〜install:react-sortable-hoc@0.0.7
npm info生命周期invariant@2.2.1~postinstall:invariant@2.2.1
npm info生命周期react-sortable-hoc@0.0。 7〜postinstall:react-sortable-hoc@0.0.7
typescript-react-mobx-boilerplate@1.0.0 / Users / velten / Websites / typescript-react-mobx-boilerplate
└─┬react -sortable-hoc@0.0.7(git://github.com/tuningguide/ react-sortable-hoc.git#09fb1e0c7d657657b9aa091c018b45aee0ed0662)
└──invariant@2.2.1

npm info ok



但文件夹不包含源文件或构建文件。为什么?

解决方案

src / 在.npmignore文件夹中被禁止如果我们谈论这个回购

  https://github.com/clauderic/react-sortable-hoc/blob/master/.npmignore 

$ b

...以及隐含的 preublish 触发器 build 只在常规的已发布的安装上发布,如果您直接从github安装,则不是 ...(同时也了解到了这一点)。

尝试使用任何知名的软件包,不要以标准方式安装,而应直接从github安装,以便验证。



确实很痛苦。用户可以在自己的仓库中做的最好的事情是使用预安装钩子。 (并且不要禁止 src / -Folder的工作)。



您可以克隆回购,允许src /文件夹(从.npmignore删除),并将构建过程移动到预安装钩子...


I did the following:

npm install TuningGuide/react-sortable-hoc --save
npm info it worked if it ends with ok
npm info using npm@3.10.5
npm info using node@v6.2.2
npm info git [ 'clone',
npm info git   '--template=/Users/velten/.npm/_git-remotes/_templates',
npm info git   '--mirror',
npm info git   'git://github.com/tuningguide/react-sortable-hoc.git',
npm info git   '/Users/velten/.npm/_git-remotes/git-github-com-tuningguide-react-sortable-hoc-git-78a804e9' ]
npm info git [ 'rev-list', '-n1', 'master' ]
npm info git [ 'clone',
npm info git   '/Users/velten/.npm/_git-remotes/git-github-com-tuningguide-react-sortable-hoc-git-78a804e9',
npm info git   '/var/folders/95/ylk5ht9s24n6xk4rcr6sch4r0000gn/T/npm-22395-24e6f9cc/git-cache-220f34bb/09fb1e0c7d657657b9aa091c018b45aee0ed0662' ]
npm info git [ 'checkout', '09fb1e0c7d657657b9aa091c018b45aee0ed0662' ]
npm info git [ 'submodule', '-q', 'update', '--init', '--recursive' ]
npm info attempt registry request try #1 at 14:18:51
npm http request GET https://registry.npmjs.org/invariant
npm http 304 https://registry.npmjs.org/invariant
npm info lifecycle invariant@2.2.1~preinstall: invariant@2.2.1
npm info lifecycle react-sortable-hoc@0.0.7~preinstall: react-sortable-hoc@0.0.7
npm info linkStuff invariant@2.2.1
npm info linkStuff react-sortable-hoc@0.0.7
npm info lifecycle invariant@2.2.1~install: invariant@2.2.1
npm info lifecycle react-sortable-hoc@0.0.7~install: react-sortable-hoc@0.0.7
npm info lifecycle invariant@2.2.1~postinstall: invariant@2.2.1
npm info lifecycle react-sortable-hoc@0.0.7~postinstall: react-sortable-hoc@0.0.7
typescript-react-mobx-boilerplate@1.0.0 /Users/velten/Websites/typescript-react-mobx-boilerplate
└─┬ react-sortable-hoc@0.0.7  (git://github.com/tuningguide/react-sortable-hoc.git#09fb1e0c7d657657b9aa091c018b45aee0ed0662)
  └── invariant@2.2.1 

npm info ok 

But the folder does not contain the source nor the build. Why?

解决方案

src/ is banned in the .npmignore folder (if we talk about this repo)

https://github.com/clauderic/react-sortable-hoc/blob/master/.npmignore

...and the implicit prepublish triggers build only on a regular "published install", not if you install directly from github... (also learnt that the hard way).

Try with any wellknown package, by not installing it in the standard way but from github directly, to verify.

Painful, indeed. Best thing one can do on his own repos is to use the "preinstall" hook. (And not ban the src/-Folder for it, to work).

You could clone the repo, allow src/ folder (remove from .npmignore), and move build-process to "preinstall" hook...

这篇关于npm安装github repo strip src文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆