DEV Community

Cover image for make npmi
erkn
erkn

Posted on

make npmi

I get bored pretty easily when I do repetitive things and try to automate them, this is one of them, I use WSL1, and run npm i a lot, but directory buried under couple of paths from the root of .git my options are npm --prefix /path/to/project i or cd /path/to/project; npm i both requires to typing the path by hand. Also another problem is npm is not a exe, it is a .bat file which you cannot run directly from WSL1, you need to switch to cmd by typing cmd.exe or open new tab, which requires mouse movement. So I have been annoyed for a while and now I had half an hour to fix the problem. The solution is

TARGET_DIR = /path/to/projec
npmi:
    cd $(TARGET_DIR) && cmd.exe /c "npm.cmd i"
Enter fullscreen mode Exit fullscreen mode

Top comments (0)