Skip to content

Wrong app root path on Windows with scoped packages and nvm #20

Description

@goloroden

I have globally installed a Node.js application on Windows, where Node.js was installed using nvm-windows. This works.

What's unusual about my scenario is that the module is a scoped one, i.e. there is an @org prefix in its name, which results in an additional directory. So the path looks like this:

C:\Users\jane.doe\AppData\Roaming\nvm\v6.7.0\node_modules\@org\my-app

This is the application's root path. Now inside of this application I am using a module. It gets installed to the application's node_modules directory, so we end up with:

C:\Users\jane.doe\AppData\Roaming\nvm\v6.7.0\node_modules\@org\my-app\node_modules/my-module

Now, this module uses app-root-path to get the root path of the application.

The expected result is:

C:\Users\jane.doe\AppData\Roaming\nvm\v6.7.0\node_modules\@org\my-app

The actual result is:

C:\Users\jane.doe\AppData\Roaming\nvm\v6.7.0

Obviously app-root-path detects the root path in a wrong way, but I am not sure why. It may be that it is because of the additional node_modules directory (which, I guess, is caused by nvm on Windows), or it may be because the application is a scoped packages.

Unfortunately, as I am not really sure about the cause, I can not provide a fix. Any ideas on this?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions