Git Product home page Git Product logo

Comments (5)

creationix avatar creationix commented on May 18, 2024

Also, I just saw that a new version of node came out that looks for modules in $PREFIX/lib/node, I just updated nvm to use this for it's $NODE_PATH directory. So if you default to the global $PREFIX based location that will work for me too.

from npm.

isaacs avatar isaacs commented on May 18, 2024

That's a great idea.

If you run npm with sudo, it'll default to $PREFIX/lib/node. If not, it'll default to $HOME/.node_libraries.

But it would be good to check the $NODE_PATH, and do something smart with it. At the very least, npm should make sure that the --root setting is in the $NODE_PATH, and show some kind of warning if it's not.

from npm.

creationix avatar creationix commented on May 18, 2024

the sudo check doesn't work for my case since my $PREFIX is in my home folder. I imagine others do this too. Maybe try to write to the global library folder and fallback to $HOME/.node_libraries if it's not possible.

from npm.

isaacs avatar isaacs commented on May 18, 2024

Discussed in IM:

  1. When not sudo, use require.paths[0]
  2. When sudo, use process.installPrefix+"/lib/node"

This also ensures that the --root config is in the require path.

from npm.

isaacs avatar isaacs commented on May 18, 2024

Fixed in 9baec09

from npm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.