Devops npm task with custom command (build) not working

感情迁移 提交于 2019-12-11 04:27:21

问题


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?

NPM Install Task

NPM Install Task with custom Build Command

npm install Task log

npm build Task log

Copy and Publish Artifact Task

Copy and Publish Task log

The script section in package.json file

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

回答1:


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.



来源:https://stackoverflow.com/questions/55119865/devops-npm-task-with-custom-command-build-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!