Updated on 2026-01-08 GMT+08:00

Using npm for Build

In this action, you build Vue and Webpack projects with npm.

Graphical Build

Add Build with npm, when configuring build actions.

The parameters are described in the following table.

Parameter

Description

Action Name

Name of a build action. It can be customized.

Tool Version

Select a tool version.

Commands

Configure the npm commands. You can also use default commands. If you have special build requirements, enter your custom build script in the text box.

Code-based Build

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
version: 2.0 # The value must be 2.0.
steps:
  BUILD:
    - npm: 
        inputs: 
          command: |
              export PATH=$PATH:~/.npm-global/bin
              npm config set registry https://repo.example.com/repository/npm/
              npm config set disturl https://repo.example.com/nodejs
              npm config set sass_binary_site https://repo.example.com/node-sass/
              npm config set phantomjs_cdnurl https://repo.example.com/phantomjs
              npm config set chromedriver_cdnurl https://repo.example.com/chromedriver
              npm config set operadriver_cdnurl https://repo.example.com/operadriver
              npm config set electron_mirror https://repo.example.com/electron/
              npm config set python_mirror https://repo.example.com/python
              npm config set prefix '~/.npm-global'
              npm install --verbose
              npm run build

Parameter

Type

Description

Mandatory

Default Value

command

String

Commands to be run.

Yes

None