【异常】Jenkins执行前端项目Npm构建时,出现报错This dependency was not found: vue-class-component in ./node_modules/vu

这篇具有很好参考价值的文章主要介绍了【异常】Jenkins执行前端项目Npm构建时,出现报错This dependency was not found: vue-class-component in ./node_modules/vu。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

一、报错截图

同事的代码变更,导致了在Jenkins无法执行构建
a new version of sass-loader is available. please upgrade for best experienc,007 - 大前端技术,前端,vue.js,jenkins

13:50:30   WARN  A new version of sass-loader is available. Please upgrade for best experience.
13:50:31  TypeError: Cannot set property mark of #<Object> which has only a getter
13:50:31  TypeError: Cannot set property mark of #<Object> which has only a getter
13:50:31      at Object.connectTypeScriptPerformance (/data/jenkins/jenkins/workspace/xxx/node_modules/fork-ts-checker-webpack-plugin-v5/lib/typescript-reporter/profile/TypeScriptPerformance.js:12:36)
13:50:31      at createTypeScriptReporter (/data/jenkins/jenkins/workspace/xxx/node_modules/fork-ts-checker-webpack-plugin-v5/lib/typescript-reporter/reporter/TypeScriptReporter.js:36:49)
13:50:31      at Object.<anonymous> (/data/jenkins/jenkins/workspace/xxx/node_modules/fork-ts-checker-webpack-plugin-v5/lib/reporter/reporter-rpc/ReporterRpcService.js:20:30)
13:50:31      at Generator.next (<anonymous>)
13:50:31      at /data/jenkins/jenkins/workspace/xxx/node_modules/fork-ts-checker-webpack-plugin-v5/lib/reporter/reporter-rpc/ReporterRpcService.js:8:71
13:50:31      at new Promise (<anonymous>)
13:50:31      at __awaiter (/data/jenkins/jenkins/workspace/xxx/node_modules/fork-ts-checker-webpack-plugin-v5/lib/reporter/reporter-rpc/ReporterRpcService.js:4:12)
13:50:31      at /data/jenkins/jenkins/workspace/xxx/node_modules/fork-ts-checker-webpack-plugin-v5/lib/reporter/reporter-rpc/ReporterRpcService.js:18:88
13:50:31      at Object.<anonymous> (/data/jenkins/jenkins/workspace/xxx/node_modules/fork-ts-checker-webpack-plugin-v5/lib/rpc/RpcService.js:23:38)
13:50:31      at Generator.next (<anonymous>)
13:50:58   ERROR  Failed to compile with 2 errors1:50:56 PM
13:50:58  
13:50:58  This dependency was not found:
13:50:58  
13:50:58  * vue-class-component in ./node_modules/vue-property-decorator/lib/index.js, ./node_modules/vue-property-decorator/lib/decorators/Watch.js
13:50:58  
13:50:58  To install it, you can run: npm install --save vue-class-component
13:50:58   ERROR  Build failed with errors.
13:50:58  npm ERR! code ELIFECYCLE
13:50:58  npm ERR! errno 1
13:50:58  npm ERR! ids@1.0.0 build: `vue-cli-service build --mode prod`
13:50:58  npm ERR! Exit status 1
13:50:58  npm ERR! 
13:50:58  npm ERR! Failed at the ids@1.0.0 build script.
13:50:58  npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
13:50:58  
13:50:58  npm ERR! A complete log of this run can be found in:
13:50:58  npm ERR!     /data/jenkins/.npm/_logs/2023-04-19T05_50_56_890Z-debug.log

二、报错说明

错误的原因是项目中引入了vue-class-component,但是在项目的依赖列表中,却没有找到它,因此会报如上的错误。

2.1 vue-class-component介绍

vue-class-component是一个用于类式Vue组件的TypeScript装饰器。
它允许您将Vue组件定义为类,这可以使您的代码更有组织性和易于阅读。
它还提供了其他装饰器,用于定义计算属性、观察者和事件处理程序。

官方文档

2.2 使用vue-class-component

要使用vue-class-component,您首先需要通过npm安装它:

npm install vue-class-component

安装后,您可以在Vue组件文件中导入它,并使用@Component装饰器将组件定义为类:

import { Component, Vue } from 'vue-class-component';

@Component
export default class MyComponent extends Vue {
  // 组件逻辑在这里
}

然后,您可以将组件的数据、方法和生命周期钩子定义为类属性和方法:

@Component
export default class MyComponent extends Vue {
  // 数据
  message: string = 'Hello, world!';

  // 方法
  onClick(): void {
    console.log('Button clicked!');
  }

  // 生命周期钩子
  mounted(): void {
    console.log('Component mounted!');
  }
}

三、报错解决

引入vue-class-component即可,并且重新执行一下Jenkins的构建,即重新build一波试试,问题解决!
a new version of sass-loader is available. please upgrade for best experienc,007 - 大前端技术,前端,vue.js,jenkins文章来源地址https://www.toymoban.com/news/detail-772758.html

到了这里,关于【异常】Jenkins执行前端项目Npm构建时,出现报错This dependency was not found: vue-class-component in ./node_modules/vu的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Jenkins自动化构建部署前端项目(Linux+gitee)

    本文讲述了Jenkins自动化构建部署前端项目,内容包括Linux系统安装Jenkins、如何配置构建项目并发布到目标服务器。 因公司系统项目众多,前端项目打包麻烦,项目代码管理混乱,因此需要gitee+Jenkins做自动化构建,优化项目打包流程及代码管理。 本次教程可实现最简单的自动

    2024年02月03日
    浏览(45)
  • Jenkins 中部署Nodejs插件并使用,并构建前端项目(3)

    遇到多个版本nodeJS需要构建的时候 1、第一种就是一个配置安装,然后进行选中配置 2、第二种就是插件:nvm-wrapper,我们还是选用NodeJS插件: (1)可以加载任意npmrc文件; (2)与Jenkins结合紧密,封装少,项目相对活跃; (3)功能丰富,可全局安装模块。 这里的路径,要把

    2024年02月22日
    浏览(36)
  • Jenkins自动拉取SVN源代码构建打包vue前端项目

    目录 1.功能需求 2.安装插件 2.1 安装NodeJS插件 2.2  安装SVN插件 3.配置环境 3.1  NodeJS环境 4.新建任务配置部署信息 4.1  源代码管理 4.2  构建触发器 4.3  构建环境  4.4  构建步骤 5.构建项目  5.1 点击查看控制台日志 使用Jenkins从SVN上拉取Vue项目进行自动构建打包。如果需要发

    2023年04月22日
    浏览(35)
  • 【前端】执行cnpm i出现,报错Error: Cannot find module ‘fs/promises‘

    一、问题: 二、分析: 由于低版本的Node.js对于promises的引入方式与高版本的是不一样的导致promises引入失败; cnpm版本太高 ,node不支持’fs/promises’引入的方式; 三、解决(两者取一即可): 查找node的安装路径=》 where node 【1】升级node版本 【2】降低cnpm的版本 四、效果:

    2024年02月15日
    浏览(31)
  • 前端项目 npm install 安装依赖报错及解决办法

    目录 第一种:Error: Cannot find module \\\'gifsicle\\\' 第二种:Error: Cannot find module \\\'imagemin-gifsicle\\\' 第三种:Error: Cannot find module \\\'array-includes\\\' 前端项目安装依赖,遇到过的问题: 第一种: Error: Cannot find module \\\'gifsicle\\\' 原因是对应的模块 image-webpack-loader 未安装好 解决办法: 卸载重新安装

    2024年02月04日
    浏览(41)
  • 前端启动项目npm run dev报错npm ERR! missing script: dev

    今天遇到了这样一个nt问题 突然前端跑不起来 后面发现是进行npm run dev 命令的时候少进入一层目录 进去之后就可以了 对此遇到这个bug我还查了很多blog 发现还有以下两种原因 1. 打开的是当前文件夹,但是文件夹package.js里的scripts确实没有dev, 输入vue init webpack 将package.json中丢

    2024年02月02日
    浏览(30)
  • 关于CICD流水线的前端项目运行错误,npm项目环境配置时出现报错:Not Found - GET https://registry.npm...

    原因应该是某些jar包缓存中没有需要改变镜像将包拉下来 npm config set registry http://registry.npm.taobao.org npm install npm run build

    2024年02月10日
    浏览(44)
  • Jenkins自动构建打包发布vue项目报错Error: error:0308010C:digital envelope routines::unsupported

    错误日志: 原因: 新版本node.js使用了OpenSSL3.0对允许算法和密钥大小增加了严格的限制。 解决办法: Windows: Linux:

    2024年02月17日
    浏览(43)
  • 如何解决npm run serve运行vue项目时,出现报错:Error: error:0308010C:digital envelope routines::unsupported

    用npm run serve运行vue项目时,出现报错:Error: error:0308010C:digital envelope routines::unsupported 前端项目启动(npm run dev)和打包时(npm run build:prod)报出如下错误, 经过一番探索,终于找到了症结所在:主要是nodeJs V17版本发布了OpenSSL3.0对算法和秘钥大小增加了更为严格的限制,no

    2023年04月26日
    浏览(35)
  • Jenkins 构建前端代码失败,报错:The package “esbuild-linux-64“ could not be found, and is needed byesbuild

    前段时间,使用公司的 Jenkins 构建测试环境时,突然构建失败,查看了构建日志,显示没有找到 esbuild-linux-64 这个包。但奇怪的是,代码在本地运行没问题,甚至使用 yarn build 命令 进行本地打包也正常,只是构建环境失败。如下如所示: 这个报错出现的就很莫名其妙,上午

    2023年04月20日
    浏览(35)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包