npm install module in current directory

后端 未结 7 1298
眼角桃花
眼角桃花 2020-12-12 21:00

When I run:

npm install my-app

The app is installed into node_modules/my-app/...

I also tried

npm install -g my-app         


        
7条回答
  •  忘掉有多难
    2020-12-12 21:46

    I think the real question, what I and the OP would want, is to install my-app, like you would install an application , i.e. Install a top level application, that I am going to "use" as an application and not "require" as a module.

    The fact that npm installs one level down from my application directory, is a purely aesthetic objection by new npm users.

    When I started using npm (not so long ago), I solved it by having a git project as an installer, clone the git, run the install script, but now I am used to it and it does not bother me to have the app in the "wrong" folder any more.

    Just setup some .sh, .bat or short cuts in the right place and your users, won't notice.

提交回复
热议问题