npm安装github repo strip src文件夹

编程入门 行业动态 更新时间:2024-10-24 20:24:26
本文介绍了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/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 registry.npmjs/invariant npm http 304 registry.npmjs/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/tuningguide/ react-sortable-hoc.git#09fb1e0c7d657657b9aa091c018b45aee0ed0662)└──invariant@2.2.1 npm info ok

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

解决方案

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

github/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/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 registry.npmjs/invariant npm http 304 registry.npmjs/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/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)

github/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文件夹

本文发布于:2023-07-04 17:23:41,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件夹   github   npm   repo   src

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!