velop velop - 3 years ago 157
Node.js Question

npm install github repo strips src folder

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://',
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
npm http 304
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://
└── invariant@2.2.1

npm info ok

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

Answer Source

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

...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...

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download