You have broken npm
by removing some of its dependencies.
are-we-there-yet
is a dependency of npmlog
which is a dependency of npm
itself, and you somehow deleted it. The usual simple solution for such cases is reinstalling a package, but that doesn't work if npm
cannot operate. Fortunately, npm
tarball comes prebundled with dependencies and hence installing npm
from scratch is as simple as unpacking a tarball.
1) Go to the global node_modules
directory (what would npm root -g
print if you could run it):
$ cd /usr/local/lib/node_modules
2) Remove the broken npm
directory or move it somewhere else (note that you might need to elevate permissions for this and the following steps):
$ mv npm /tmp
3) Download and unpack fresh npm
from the registry (substitute version you want to install, e.g. 3.10.8
):
$ curl -L registry.npmjs.com/npm/-/npm-{VERSION}.tgz | tar xz --transform="s:^package:npm:"
You can automate some of that with this install script:
$ curl -L https://www.npmjs.com/install.sh | sh
At this point npm
should work again.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…