node.js - npm install github repo 剥离 src 文件夹

标签 node.js github npm

我做了以下事情:

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 

folder

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

最佳答案

src/ 在 .npmignore 文件夹中被禁止(如果我们谈论 this repo )

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

...隐式 prepublish 仅在常规“已发布安装”上触发 build,如果您直接从 github 安装,不会。 ..(也是通过艰难的方式了解到的)。

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

确实很痛苦。一个人可以在自己的 repo 协议(protocol)上做的最好的事情就是使用“预安装” Hook 。 (并且不禁止 src/-Folder 让它工作)。

您可以克隆存储库,允许 src/文件夹(从 .npmignore 中删除),并将构建过程移动到“预安装” Hook ...

关于node.js - npm install github repo 剥离 src 文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38896891/

相关文章:

javascript - Nodejs,观察类字段的变化

javascript - 如何安装所有 npm 依赖项的特定版本/标签

javascript - 用于在特定时间触发事件的 Node.js 类 Cron 库

node.js - Windows Azure 上 Node.js 站点的默认根 (server.js) 文件

javascript - 运行react/redux应用程序所需的最低server.js?

git - 如何在 github repo 的文件夹/目录中获取最后提交日期?

python - SciPy 源代码 - 找不到导入的模块

python - 使用 GitHub 身份验证在不使用 GitHub API 的情况下查看私有(private)存储库

node.js - 使用 Electron 应用程序有效地捆绑依赖项以进行分发

javascript - 如何运行多个异步函数然后执行回调?