gpt4 book ai didi

npm - 带有自定义命令(构建)的 Devops npm 任务不起作用

转载 作者:行者123 更新时间:2023-12-04 01:12:42 26 4
gpt4 key购买 nike

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

为了安装节点包,我使用了带有内置“安装”命令的 npm 任务。

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

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



我相信它根本没有像我去 Copy Publish Artifact 那样进行构建,它说

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”命令,但收到错误

"NPM failed with return code: 1"



有一些堆栈溢出线程( Here ),人们将构建称为安装的内部命令。如果确实如此,为什么我看不到安装命令创建的 dist 文件夹,或者我的自定义命令 npm 任务有问题?

enter image description here

NPM 安装任务
enter image description here

带有自定义构建命令的 NPM 安装任务
enter image description here

npm install 任务日志
enter image description here

npm 构建任务日志
enter image description here

复制和发布工件任务
enter image description here

复制和发布任务日志
enter image description here

package.json 文件中的脚本部分
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},

最佳答案

对于“npm build”任务,自定义命令(在上面的问题中,尝试过“build”和“npm run-script build”)应该是“run-script build”。构建已成功创建 dist 文件夹。

enter image description here

关于npm - 带有自定义命令(构建)的 Devops npm 任务不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55119865/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com