Can I hide or silence “npm ERR!” output when using npm run script?

后端 未结 5 1433
余生分开走
余生分开走 2021-01-03 18:04

I\'m using npm run script to do tasks such as \"build\" and \"test\".

For example, my package.json looks like the following:

{
  \"name\         


        
5条回答
  •  孤独总比滥情好
    2021-01-03 18:19

    There is an issue filed on npm: run-scripts are too noisy while used in development #8821 (also mentioned in a comment above)

    In the discussion in that issue, a couple of people have mentioned creating an alias e.g. npr (utilizing the --silent option gcampbell describes in his/her answer). Although --silent can hide some npm type issues such as a malformed package.json, this seems like a reasonable solution for now.

    alias npr='npm run --silent $*'
    

    One other thing from that discussion which may be worth looking into, although it is yet another tool, is yarn which is described on a facebook blog post.

提交回复
热议问题