Sitemap
JavaScript in Plain English

New JavaScript and Web Development content every day. Follow to join our 3.5M+ monthly readers.

Member-only story

Interviewer: What Happened to “npm run xxx”?

A secret that most people don’t know.

6 min readJun 10, 2022

--

Press enter or click to view image in full size

Preface

Recently, I participated in an interview that made a deep impression on me. After many twists and turns, I finally got the offer. You can’t imagine what I went through.

1. My interview process

Interviewer:

Please tell me what happened when “npm run xxx”? The more detailed the better.

Me:

I thought to myself, “I’m ashamed. As a front-end developer, I use the npm run xxx command every day, such as npm run dev, npm run build, and so on. But I haven’t really understood what happened behind it.

Fortunately, I remember at least the following:

When we execute the “npm run xxx” command, it will first go to the project’s package.json file to find xxx in scripts, and then execute the xxx command.

For example, when you start a Vue.js project and execute npm run serve, you actually execute the vue-cli-service serve command.

--

--

fatfish
fatfish

Written by fatfish

Hi friends, I am a front-end engineer from Alibaba, let’s code happily together.

JavaScript in Plain English
JavaScript in Plain English

Published in JavaScript in Plain English

New JavaScript and Web Development content every day. Follow to join our 3.5M+ monthly readers.