Speeding up the npm install

前端 未结 8 1902
忘掉有多难
忘掉有多难 2021-02-01 14:54

I am trying to speed up the npm install during the build process phase. My package.json has the list of packages pretty much with locked revisions in it. I\'ve also configured t

8条回答
  •  臣服心动
    2021-02-01 15:22

    As suggested by @Daniel Serodio

    You could also include your node_modules folder inside your repository but you should probably zip it first than add to repo, and while installing you can unzip it and just

     npm rebuild
    

    (which works cross platform) it is quite fast.

    This would also give you the benefit of full control over all your dependencies.

    Also you can set the process flag to false to increase your speed by 2x.

    npm set progress=false
    

    Read source for more info

    Update: You can also use pnpm for this

    npm i -g pnpm
    

    This basically use local cached modules (i have heard its better then YARN)

提交回复
热议问题