throw new Error(‘Invalid version: “‘+ data.version + ‘“‘)

在尝试运行npmrundev时遇到错误,原因是package.json中的version字段值6.4.1.0不符合标准的版本格式(major.minor.patch)。修复此问题需要将version改为6.4.1,确保它是有效的版本标识符。文章还强调了版本号各部分的含义:patch用于修复bug,minor用于添加新功能,major表示重大变更可能导致不兼容。

问题背景:

修改package.json中的version信息为:6.4.1.0。

npm run dev报错信息如下:

F:\>npm run dev

> ui-admin@6.4.1.0 dev  
> vue-cli-service serve --mode dev

F:\node_modules\normalize-package-data\lib\fixer.js:191
      throw new Error('Invalid version: "'+ data.version + '"')
      ^

Error: Invalid version: "6.4.1.0"
    at Object.fixVersionField (F:\node_modules\normalize-package-data\lib\fixer.js:191:13)
    at F:\node_modules\normalize-package-data\lib\normalize.js:32:38
    at Array.forEach (<anonymous>)
    at normalize (F:\node_modules\normalize-package-data\lib\normalize.js:31:15)
    at AsyncFunction.module.exports.sync (F:\\node_modules\read-pkg\index.js:37:36)
    at exports.resolvePkg (F:\node_modules\@vue\cli-shared-utils\lib\pkg.js:7:20)
    at Service.resolvePkg (F:\node_modules\@vue\cli-service\lib\Service.js:47:17)
    at new Service (F:\node_modules\@vue\cli-service\lib\Service.js:27:21)
    at Object.<anonymous> (F:\node_modules\@vue\cli-service\bin\vue-cli-service.js:15:17)
    at Module._compile (node:internal/modules/cjs/loader:1196:14)

 package.json信息如下:

{
  "name": "yudao-ui-admin",
  "version": "6.4.1.0",
  "description": "芋道管理系统",
  "author": "芋道",
  "license": "MIT",
  "scripts": {
    "local": "vue-cli-service serve --mode local",
    "dev": "vue-cli-service serve --mode dev",
    "front": "vue-cli-service serve --mode front",
    "build:prod": "vue-cli-service build --mode prod",
    "build:stage": "vue-cli-service build --mode stage",
    "build:dev": "vue-cli-service build --mode dev",
    "build:static": "vue-cli-service build --mode static",
    "preview": "node build/index.js --preview",
    "lint": "eslint --ext .js,.vue src",
    "clean": "rimraf node_modules"
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "src/**/*.{js,vue}": [
      "eslint --fix",
      "git add"
    ]
  },
  "keywords": [
    "vue",
    "admin",
    "dashboard",
    "element-ui",
    "boilerplate",
    "admin-template",
    "management-system"
  ],
  "repository": {
    "type": "git",
    "url": "https://github.com/YunaiV/ruoyi-vue-pro"
  },
  "dependencies": {
    "@babel/parser": "7.18.4",
    "@riophae/vue-treeselect": "0.4.0",
    "axios": "0.27.2",
    "benz-amr-recorder": "^1.1.5",
    "bpmn-js-token-simulation": "0.10.0",
    "clipboard": "2.0.8",
    "core-js": "^3.26.0",
    "crypto-js": "^4.0.0",
    "echarts": "5.4.0",
    "element-ui": "2.15.12",
    "file-saver": "2.0.5",
    "fuse.js": "6.6.2",
    "highlight.js": "9.18.5",
    "js-beautify": "1.13.0",
    "jsencrypt": "3.3.1",
    "min-dash": "3.5.2",
    "nprogress": "0.2.0",
    "qrcode.vue": "^1.7.0",
    "quill": "1.3.7",
    "screenfull": "5.0.2",
    "sortablejs": "1.10.2",
    "throttle-debounce": "2.1.0",
    "vue": "2.7.14",
    "vue-count-to": "1.0.13",
    "vue-cropper": "0.5.8",
    "vue-meta": "^2.4.0",
    "vue-quill-editor": "^3.0.6",
    "vue-router": "3.4.9",
    "vue-video-player": "^5.0.2",
    "vuedraggable": "2.24.3",
    "vuex": "3.6.2",
    "xml-js": "1.6.11"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "4.5.18",
    "@vue/cli-plugin-eslint": "4.5.18",
    "@vue/cli-service": "4.5.18",
    "@vue/compiler-sfc": "^3.0.1",
    "@vue/eslint-config-prettier": "^5.0.0",
    "babel-eslint": "10.1.0",
    "bpmn-js": "8.9.0",
    "bpmn-js-properties-panel": "0.46.0",
    "chalk": "4.1.0",
    "compression-webpack-plugin": "5.0.2",
    "connect": "3.6.6",
    "eslint": "7.15.0",
    "eslint-config-airbnb-base": "^14.0.0",
    "eslint-plugin-import": "^2.26.0",
    "eslint-plugin-prettier": "^3.1.0",
    "eslint-plugin-vue": "9.0.0",
    "fs-extra": "^8.1.0",
    "lint-staged": "12.5.0",
    "runjs": "4.4.2",
    "sass": "1.32.13",
    "sass-loader": "10.2.0",
    "script-ext-html-webpack-plugin": "2.1.5",
    "svg-sprite-loader": "5.1.1",
    "terser-webpack-plugin": "^4.2.3",
    "webpack-bundle-analyzer": "^3.9.0"
  },
  "engines": {
    "node": ">= 10.13.0",
    "npm": ">= 5.0.0"
  },
  "browserslist": [
    "> 1%",
    "last 2 versions"
  ]
}

解决方案:

package.json中的version字段信息,不能为6.4.1.0,需修改为6.4.1。

问题原因:

版本格式:major.minor.patch

主版本号.次版本号.修补版本号

patch:修复bug,兼容老版本

minor:新增功能,兼容老版本

major:新的架构调整,不兼容老版本

PS C:\Users\Administrator> Install-Module -Name Pester -Force -SkipPublisherCheck >> 需需要要使使用用 NuGet 提提供供程程序序来来继继续续操操作作 PowerShellGet 需需要要使使用用 NuGet 提提供供程程序序““2.8.5.201””或或更更高高版版本本来来与与基基于于 NuGet 的的存存储储库库交交互互。。必必须须在在““C:\Program Files\PackageManagement\ProviderAssemblies””或或““C:\Users\Administrator\AppData\Local\PackageManagement\ProviderAssemblies”” 中提供 NuGet 提供程序。也可以通过运行 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force' 安装 NuGet 提供程序。是否要让 PowerShellGet 立即安装并导入 NuGet 提供程序? [Y] 是(Y) [N] 否(N) [S] 暂停(S) [?] 帮助 (默认值为“Y”): y PS C:\Users\Administrator> PS C:\Users\Administrator> PS C:\Users\Administrator> # 执行所有测试 >> Invoke-Pester -Path "E:\CurlTools\Modules\Tests\CurlTools.Tests.ps1" >> >> # 输出示例 >> Describing 模块加载测试 >> [+] 应成功导入模块 102ms >> [+] 应导出Get-CurlPath函数 41ms >> [+] 应正确检测curl.exe路径 35ms >> >> Describing 核心功能测试 >> [+] Get-CurlPath返回有效的可执行文件路径 52ms >> [+] Get-CurlVersion返回版本信息 78ms >> [+] Invoke-SecureDownload成功下载文件 1.2s >> [+] 优雅处理无效URL 45ms >> >> Describing 安全策略测试 >> [+] 应拒绝未授权域名 32ms >> [+] 应允许github.com下载 890ms >> 所在位置 行:6 字符: 4 + [+] 应成功导入模块 102ms + ~ "[" 后面缺少类型名称。 所在位置 行:7 字符: 4 + [+] 应导出Get-CurlPath函数 41ms + ~ "[" 后面缺少类型名称。 所在位置 行:8 字符: 4 + [+] 应正确检测curl.exe路径 35ms + ~ "[" 后面缺少类型名称。 所在位置 行:11 字符: 4 + [+] Get-CurlPath返回有效的可执行文件路径 52ms + ~ "[" 后面缺少类型名称。 所在位置 行:12 字符: 4 + [+] Get-CurlVersion返回版本信息 78ms + ~ "[" 后面缺少类型名称。 所在位置 行:13 字符: 4 + [+] Invoke-SecureDownload成功下载文件 1.2s + ~ "[" 后面缺少类型名称。 所在位置 行:14 字符: 4 + [+] 优雅处理无效URL 45ms + ~ "[" 后面缺少类型名称。 所在位置 行:17 字符: 4 + [+] 应拒绝未授权域名 32ms + ~ "[" 后面缺少类型名称。 所在位置 行:18 字符: 4 + [+] 应允许github.com下载 890ms + ~ "[" 后面缺少类型名称。 + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : MissingTypename PS C:\Users\Administrator> name: CurlTools CI >> >> on: [push, pull_request] >> >> jobs: >> test: >> runs-on: windows-latest >> steps: >> - uses: actions/checkout@v2 >> - name: Setup PowerShell >> uses: actions/setup-powershell@v1 >> with: >> pwsh: true >> - name: Run Pester tests >> run: | >> Install-Module Pester -Force -AllowClobber >> Invoke-Pester -Path .\Modules\Tests\ -OutputFile TestResults.xml -OutputFormat NUnitXml >> - name: Publish test results >> uses: actions/upload-artifact@v2 >> with: >> name: TestResults >> path: TestResults.xml >> 所在位置 行:9 字符: 6 + - uses: actions/checkout@v2 + ~ 一元运算符“-”后面缺少表达式。 所在位置 行:9 字符: 7 + - uses: actions/checkout@v2 + ~~~~~ 表达式或语句中包含意外的标记“uses:”。 所在位置 行:10 字符: 6 + - name: Setup PowerShell + ~ 一元运算符“-”后面缺少表达式。 所在位置 行:10 字符: 7 + - name: Setup PowerShell + ~~~~~ 表达式或语句中包含意外的标记“name:”。 所在位置 行:14 字符: 6 + - name: Run Pester tests + ~ 一元运算符“-”后面缺少表达式。 所在位置 行:14 字符: 7 + - name: Run Pester tests + ~~~~~ 表达式或语句中包含意外的标记“name:”。 所在位置 行:18 字符: 6 + - name: Publish test results + ~ 一元运算符“-”后面缺少表达式。 所在位置 行:18 字符: 7 + - name: Publish test results + ~~~~~ 表达式或语句中包含意外的标记“name:”。 + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : MissingExpressionAfterOperator PS C:\Users\Administrator> It "应处理大文件下载" { >> # 测试>1GB文件下载 >> } >> >> It "应验证文件哈希" { >> # 测试哈希校验功能 >> } >> >> It "应限制下载速度" { >> # 测试限速功能 >> } >> 不能对 Null 值表达式调用方法。 所在位置 C:\Program Files\WindowsPowerShell\Modules\Pester\5.7.1\Pester.psm1:1026 字符: 35 + ... ath = @(<# Get full name #> $history = $state.Stack.ToArray(); [Array ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [],RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull 使用“1”个参数调用“Reverse”时发生异常:“值不能为 null。 参数名: array” 所在位置 C:\Program Files\WindowsPowerShell\Modules\Pester\5.7.1\Pester.psm1:1026 字符: 70 + ... $history = $state.Stack.ToArray(); [Array]::Reverse($history); $histo ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : ArgumentNullException 不能对 Null 值表达式调用方法。 所在位置 C:\Program Files\WindowsPowerShell\Modules\Pester\5.7.1\Pester.psm1:1051 字符: 5 + $state.CurrentBlock.Tests.Add($Test) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [],RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull 不能对 Null 值表达式调用方法。 所在位置 C:\Program Files\WindowsPowerShell\Modules\Pester\5.7.1\Pester.psm1:1052 字符: 5 + $state.CurrentBlock.Order.Add($Test) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [],RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull 不能对 Null 值表达式调用方法。 所在位置 C:\Program Files\WindowsPowerShell\Modules\Pester\5.7.1\Pester.psm1:1026 字符: 35 + ... ath = @(<# Get full name #> $history = $state.Stack.ToArray(); [Array ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [],RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull 使用“1”个参数调用“Reverse”时发生异常:“值不能为 null。 参数名: array” 所在位置 C:\Program Files\WindowsPowerShell\Modules\Pester\5.7.1\Pester.psm1:1026 字符: 70 + ... $history = $state.Stack.ToArray(); [Array]::Reverse($history); $histo ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : ArgumentNullException 不能对 Null 值表达式调用方法。 所在位置 C:\Program Files\WindowsPowerShell\Modules\Pester\5.7.1\Pester.psm1:1051 字符: 5 + $state.CurrentBlock.Tests.Add($Test) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [],RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull 不能对 Null 值表达式调用方法。 所在位置 C:\Program Files\WindowsPowerShell\Modules\Pester\5.7.1\Pester.psm1:1052 字符: 5 + $state.CurrentBlock.Order.Add($Test) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [],RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull 不能对 Null 值表达式调用方法。 所在位置 C:\Program Files\WindowsPowerShell\Modules\Pester\5.7.1\Pester.psm1:1026 字符: 35 + ... ath = @(<# Get full name #> $history = $state.Stack.ToArray(); [Array ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [],RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull 使用“1”个参数调用“Reverse”时发生异常:“值不能为 null。 参数名: array” 所在位置 C:\Program Files\WindowsPowerShell\Modules\Pester\5.7.1\Pester.psm1:1026 字符: 70 + ... $history = $state.Stack.ToArray(); [Array]::Reverse($history); $histo ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : ArgumentNullException 不能对 Null 值表达式调用方法。 所在位置 C:\Program Files\WindowsPowerShell\Modules\Pester\5.7.1\Pester.psm1:1051 字符: 5 + $state.CurrentBlock.Tests.Add($Test) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [],RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull 不能对 Null 值表达式调用方法。 所在位置 C:\Program Files\WindowsPowerShell\Modules\Pester\5.7.1\Pester.psm1:1052 字符: 5 + $state.CurrentBlock.Order.Add($Test) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [],RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull PS C:\Users\Administrator> It "应处理网络中断" { >> # 使用Fiddler或Charles模拟网络中断 >> } >> 不能对 Null 值表达式调用方法。 所在位置 C:\Program Files\WindowsPowerShell\Modules\Pester\5.7.1\Pester.psm1:1026 字符: 35 + ... ath = @(<# Get full name #> $history = $state.Stack.ToArray(); [Array ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [],RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull 使用“1”个参数调用“Reverse”时发生异常:“值不能为 null。 参数名: array” 所在位置 C:\Program Files\WindowsPowerShell\Modules\Pester\5.7.1\Pester.psm1:1026 字符: 70 + ... $history = $state.Stack.ToArray(); [Array]::Reverse($history); $histo ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : ArgumentNullException 不能对 Null 值表达式调用方法。 所在位置 C:\Program Files\WindowsPowerShell\Modules\Pester\5.7.1\Pester.psm1:1051 字符: 5 + $state.CurrentBlock.Tests.Add($Test) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [],RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull 不能对 Null 值表达式调用方法。 所在位置 C:\Program Files\WindowsPowerShell\Modules\Pester\5.7.1\Pester.psm1:1052 字符: 5 + $state.CurrentBlock.Order.Add($Test) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [],RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull PS C:\Users\Administrator>
08-15
05-30 14:29:36.486 11192 11192 W System.err: java.lang.IllegalArgumentException 05-30 14:29:36.486 11192 11192 W System.err: at android.os.BinderProxy.transactNative(Native Method) 05-30 14:29:36.486 11192 11192 W System.err: at android.os.BinderProxy.transact(BinderProxy.java:689) 05-30 14:29:36.486 11192 11192 W System.err: at vendor.xiaomi.hardware.misys.common.IMiSysImpl$Stub$Proxy.MiSysWriteFile(IMiSysImpl.java:469) 05-30 14:29:36.486 11192 11192 W System.err: at com.longcheertel.AutoTest.MiSysUtils.writeFileToPersist(MiSysUtils.java:83) 05-30 14:29:36.486 11192 11192 W System.err: at com.longcheertel.AutoTest.AutoTest.checkCamOtp(AutoTest.java:602) 05-30 14:29:36.486 11192 11192 W System.err: at com.longcheertel.AutoTest.AutoTest.-$$Nest$mcheckCamOtp(AutoTest.java:0) 05-30 14:29:36.486 11192 11192 W System.err: at com.longcheertel.AutoTest.AutoTest$MyReceiver.onReceive(AutoTest.java:369) 05-30 14:29:36.486 11192 11192 W System.err: at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0(LoadedApk.java:1880) 05-30 14:29:36.486 11192 11192 W System.err: at android.app.LoadedApk$ReceiverDispatcher$Args.$r8$lambda$mcNAAl1SQ4MyJPyDg8TJ2x2h0Rk(Unknown Source:0) 05-30 14:29:36.486 11192 11192 W System.err: at android.app.LoadedApk$ReceiverDispatcher$Args$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0) 05-30 14:29:36.486 11192 11192 W System.err: at android.os.Handler.handleCallback(Handler.java:959) 05-30 14:29:36.486 11192 11192 W System.err: at android.os.Handler.dispatchMessage(Handler.java:100) 05-30 14:29:36.486 11192 11192 W System.err: at android.os.Looper.loopOnce(Looper.java:249) 05-30 14:29:36.486 11192 11192 W System.err: at android.os.Looper.loop(Looper.java:337) 05-30 14:29:36.486 11192 11192 W System.err: at android.app.ActivityThread.main(ActivityThread.java:9678) 05-30 14:29:36.486 11192 11192 W System.err: at java.lang.reflect.Method.invoke(Native Method) 05-30 14:29:36.486 11192 11192 W System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:625) 05-30 14:29:36.486 11192 11192 W System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936) 05-30 14:29:36.486 2557 3414 W ActivityManager: pid 11192 com.longcheertel.AutoTest sent binder code 4 with flags 0 to frozen apps and got error -22
05-31
import microsoft.exchange.webservices.data.*; import microsoft.exchange.webservices.data.core.service.item.EmailMessage; import microsoft.exchange.webservices.data.core.service.item.Item; import microsoft.exchange.webservices.data.core.service.schema.ItemSchema; import microsoft.exchange.webservices.data.property.complex.FileAttachment; import microsoft.exchange.webservices.data.search.FindItemsResults; import microsoft.exchange.webservices.data.search.ItemView; import microsoft.exchange.webservices.data.search.filter.SearchFilter; import java.net.URI; public class EWSAttachmentDownloader { public static void main(String[] args) { try { ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2016); service.setCredentials(new WebCredentials("user@domain.com", "password")); service.setUrl(new URI("https://outlook.office365.com/ews/Exchange.asmx")); // 搜索收件箱中带附件的邮件 SearchFilter hasAttachmentFilter = new SearchFilter.IsGreaterThan(ItemSchema.HasAttachments, false); ItemView view = new ItemView(50); // 限制为50封邮件 FindItemsResults<Item> results = service.findItems(WellKnownFolderName.Inbox, hasAttachmentFilter, view); for (Item item : results.getItems()) { EmailMessage email = EmailMessage.bind(service, item.getId()); email.load(new PropertySet(ItemSchema.Attachments)); for (FileAttachment attachment : email.getAttachments().getFileAttachments()) { String filePath = "C:/downloads/" + attachment.getName(); attachment.load(filePath); System.out.println("附件下载完成: " + filePath); } } } catch (Exception e) { System.err.println("错误: " + e.getMessage()); e.printStackTrace(); } } }这段代码会部署到服务器上,怎么把附件下载到用户本地计算机的指定路径下
最新发布
08-30
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值