Can a custom directory name be used instead of 'node_modules' when installing node packages?

前端 未结 3 549
我寻月下人不归
我寻月下人不归 2020-12-14 05:42

I create a package.json, I run npm install, it works alright. It creates a node_modules directory in my root folder (which I can chang

3条回答
  •  盖世英雄少女心
    2020-12-14 06:06

    Yarn you can easily achieve this by adding a file called '.yarnrc' with contents like this:

    # ./.yarnrc
    --modules-folder lib
    

    Next time you run 'yarn' it will create the lib folder and install packages into there instead of into node_modules.

    Now if only we could get 'npm install' to be as clever.

提交回复
热议问题