Skip to content


Subversion checkout URL

You can clone with
Download ZIP


could not install packages globally with package.json in global node directories #4827

trinonsense opened this Issue · 3 comments

4 participants


I created a symlink for a package.json in the global npm directory, like so:

/usr/local/lib/package.json -> ~/path/to/my/dotfiles/package.json

Then I ran these commands to install global node packages from the package.json symlink:

cd /usr/local/lib
npm install -g

...and then I get this error

npm ERR! System Darwin 13.0.0
npm ERR! command "/usr/local/Cellar/node/0.10.26/bin/node" "/usr/local/bin/npm" "install" "-g"
npm ERR! cwd /usr/local/lib
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! path /var/folders/22/9byr5_b10xn9rmxd0y_fnxpw0000gn/T/npm-16102-CRdnP8aI/1393805630684-0.25814521964639425/package/package.json
npm ERR! code ENOENT
npm ERR! errno 34

I first tried running npm install without the -g flag, the packages were downloaded and placed correctly, but the package symlinks for executables and man pages were not properly set as a global install


  • What is causing that error and what is the solution?
  • Is there a better method to achive the same goal?

When you type npm install -g, that means "install the current package folder (current working directory) as a global package".

Since your current working directory IS the package install dir... well... I don't know what would happen. But a random weird ENOENT is probably not the worst way it could fail, I guess.

It seems like your goal is to install a set of global packages all at the top-level? You could do this, I suppose:

npm i -g jsontool
node -e "
deps=$(json dependencies</usr/local/lib/package.json)
for (var i in x) {
  console.log(i + '@' + deps[i])
" | xargs npm install -g
@othiym23 othiym23 added the support label

@trinonsense , Is this still a problem for you?

This is an unusual use case -- did you try the approach @isaacs suggested above, or did you change the way you were using npm?

There have been a lot of improvements to npm -- especially around conflicts and race conditions during install -- since 1.4.3. Can you try updating your npm installation?

To update npm, run npm -g install npm@latest

We are trying to clean up older npm issues, so if we don't hear back from you within a week, we will close this issue. (Don't worry -- you can always come back again and open a new issue!)



Closing as abandoned.

@othiym23 othiym23 closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.