From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id AC1F7139BC6 for ; Thu, 17 Sep 2015 18:51:23 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0749FE08D4; Thu, 17 Sep 2015 18:51:08 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 05487E08BD for ; Thu, 17 Sep 2015 18:51:06 +0000 (UTC) Received: from [192.168.1.100] (c-98-218-46-55.hsd1.md.comcast.net [98.218.46.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mjo) by smtp.gentoo.org (Postfix) with ESMTPSA id DB49334087C for ; Thu, 17 Sep 2015 18:51:04 +0000 (UTC) Subject: Re: [gentoo-user] npm: ERR! cb() never called! To: gentoo-user@lists.gentoo.org References: <55FAC831.40900@gmail.com> From: Michael Orlitzky X-Enigmail-Draft-Status: N1110 Message-ID: <55FB0B92.2050108@gentoo.org> Date: Thu, 17 Sep 2015 14:50:58 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 In-Reply-To: <55FAC831.40900@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Archives-Salt: 92ea329c-f39c-424e-b8f0-73e501534691 X-Archives-Hash: a1dfd048bed135b5d42ec676e918dc07 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, ), 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. > 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. 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). 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. 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.