3
votes

I am trying to automate the build process (Azure Devops) for my Vue.js application by making use of "npm" task.

To Install the node packages, I have used npm task with built in "install" command.

For build process, I have deployed another npm task but with custom command (build). This custom build command runs successfully with the following warning

"npm WARN build 'npm build' called with no arguments. Did you mean to 'npm run-script build'?"

I believe it is not doing the build at all as when I go the Copy Publish Artifact, it says

Total files copied: 0. [warning]Directory 'D:\a\3\a\drop' is empty. Nothing will be added to build artifact 'drop'.

I have tried 'npm run-script build' command but get the error

"NPM failed with return code: 1"

There are some stack overflow threads (Here) where people mentioned the build as an internal command of install. If that's really the case, why I can't see the dist folder created by the install command or I am doing something wrong with my custom command npm task?

enter image description here

NPM Install Task enter image description here

NPM Install Task with custom Build Command enter image description here

npm install Task log enter image description here

npm build Task log enter image description here

Copy and Publish Artifact Task enter image description here

Copy and Publish Task log enter image description here

The script section in package.json file

"scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
1

1 Answers

6
votes

For "npm build" task, the custom command (In question above, tried "build" and "npm run-script build") should be "run-script build". The build has successfully created the dist folder.

enter image description here