Giter Site home page Giter Site logo

Comments (4)

inxilpro avatar inxilpro commented on July 29, 2024 3

Hmm… I can see how symlinked files could cause issues, assuming that the actual path to the module contains node_modules in it. I'm honestly not sure the best way to approach this problem. In this scenario you're probably better off just using the alternate method:

path.dirname(require.main.filename);

This will work as long as you're not using something like pm2 to run your app.

I'll dig into this further… not sure if there's going to be a universal solution to this particular setup.

from node-app-root-path.

newz2000 avatar newz2000 commented on July 29, 2024

Thanks, in the mean time with the app I'm building I have a configuration object where I can pass the path through, which I'll do. I found your project based on the Stack Overflow discussion. If you ever do get any clever ideas I'd love to hear more. If I come up with something better I'll share it here too.

from node-app-root-path.

inxilpro avatar inxilpro commented on July 29, 2024

I'm going to close this for now. I don't think there is a solution to this particular use-case.

from node-app-root-path.

enuggetry avatar enuggetry commented on July 29, 2024

I think I hit this problem.
mymodule uses app-root-path. it had always work installing the module using the traditional npm install method. But, when I used npm link, it failed.
I am copying something into the app root directory. As an npm link module, app-root-path returns /home/me/mymodule, not /home/me/myapp. using npm link, /home/me/mymodule is symlinked into /home/me/myapp/node_modules/mymodule.

from node-app-root-path.

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.