使用自定义命令(构建)的Devops npm任务不起作用 [英] Devops npm task with custom command (build) not working

查看:194
本文介绍了使用自定义命令(构建)的Devops npm任务不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过使用"npm"任务来自动化Vue.js应用程序的构建过程(Azure Devops).

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

要安装节点软件包,我已将npm任务与内置的"install"命令一起使用.

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

对于构建过程,我已经部署了另一个npm任务,但是带有自定义命令(构建).此自定义构建命令成功运行,并显示以下警告

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',不带任何参数.您的意思是 'npm run-script build'?"

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

它说

已复制的文件总数:0.[警告]目录'D:\ a \ 3 \ a \ drop'为空. 不会添加任何东西来构建工件放置".

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

我尝试了'npm run-script build'命令,但收到错误

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

"NPM失败,返回码:1"

"NPM failed with return code: 1"

有一些堆栈溢出线程(在这里),人们提到该构建是install的内部命令.如果真是这样,为什么我看不到install命令创建的dist文件夹,或者我的自定义命令npm任务做错了什么?

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安装任务

带有自定义构建命令的NPM安装任务

NPM Install Task with custom Build Command

npm install任务日志

npm install Task log

npm构建任务日志

npm build Task log

复制和发布工件任务

Copy and Publish Artifact Task

复制和发布任务日志

Copy and Publish Task log

package.json文件中的脚本部分

The script section in package.json file

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

推荐答案

对于"npm build"任务,自定义命令(在上面的问题中,尝试过"build"和"npm run-script build")应为"run-脚本构建".构建已成功创建dist文件夹.

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.

这篇关于使用自定义命令(构建)的Devops npm任务不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆