On 17/09/2015 20:50, Michael Orlitzky wrote: > On 09/17/2015 10:03 AM, Alan McKinnon wrote: >> Anyone here familiar with driving nodejs and npm? >> >> I'm trying to write an ebuild for a musicbrainz mirror server and "npm >> install" keeps erroring out with one of two errors: >> >> 1. The install does finish but npm doesn't get around to exiting, >> verified by stopping the emerge, running npm install manually and seeing >> that it does nothing. When it stalls strace shows the last call was >> (poll,<number> ), which implies a race condition. >> >> 2. More and more often now I get the dreaded "npm: ERR! cb() never >> called!" error message which Google and stackoverflow say has been an >> ongoing issue for 3 years now. If I keep retrying it eventually >> succeeds, implying a race condition of some sort. >> >
Hi Michael, I reached pretty much the same conclusions as you. And yes, it is src_prepare() not allowing network access that caused most of the weirdness. I must have had the packages cached causing them to install correctly the first time. I've since cleaned the npm cache and of course now they fail. After I posted my mail I went through the npm bugs at bgo and the unstated message from the gentoo devs is loud and clear - "you are not putting that shit in the tree" So I took the easiest possible way out: deleted src_prepare() and issued an elog to "cd $inst_dir && npm install, and do not use -g" > I went through this wonderful experience a few weeks ago. You're not > allowed to access the network in src_prepare, so that might be > contributing to your weirdness. I came up with two options: > > 1) Run `npm install` on your dev machine, and then package up the result > as a tarball. Generate the manifest from the tarball, and then in your > src_install, just copy stuff over. > > src_install(){ > local npm_module_dir="/usr/$(get_libdir)/node/${PN}" > insinto "${npm_module_dir}" > doins -r whatever > ... > } > > > This is the lazy way, but avoids you having to package 1,000 other > things all written by people who just "learned to code" by googling HOW > DO I HTML5. Agreed. The quality of node software is atrocious, and the package manager is even worse. read "npm faq", it is most enlightening and gives insight into people's heads.... > > 2) The right way to do it is to use an eclass and install all of the > dependencies using separate packages. As you can imagine, this is a > nightmare if you have more than a few dependencies (looks like you do). Errr, no :-) g-cpan is bad enough and those ebuilds are mostly template-able. At least CPAN modules mostly respond correctly to make && make install. That node stuff doesn't look like it will ever package sanely. > > I started an eclass for npm packages. I left the overlay here: > > https://github.com/orlitzky/npm > > but no one else seemed interested in having it in-tree, and the whole > ecosystem is kind of scary to me anyway. Indeed. > > So, for the large package I need, I'm doing it the lazy way: npm install > on my machine, and make an ebuild for the resulting huge tarball. Thanks for the feedback -- Alan McKinnon alan.mckin...@gmail.com