使用npm 8.11及以上版本无法构建Shopware语言包
Shopware 6.4.17.1 管理前端构建npm版本兼容问题
在CI/CD流水线中构建Shopware 6.4.17.1时,执行bin/build-administration.sh生成管理前端时遇到npm错误:当使用npm 8.11或更高版本时,会在swag-language-pack依赖安装阶段触发如下报错:
=> Installing npm dependencies for swag-language-pack npm ERR! code EUSAGE npm ERR! npm ERR! `npm ci` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing. npm ERR! npm ERR! Missing: webpack@5.75.0 from lock file npm ERR! Missing: @types/eslint-scope@3.7.4 from lock file npm ERR! Missing: @types/estree@0.0.51 from lock file npm ERR! Missing: @webassemblyjs/ast@1.11.1 from lock file npm ERR! Missing: @webassemblyjs/wasm-edit@1.11.1 from lock file npm ERR! Missing: @webassemblyjs/wasm-parser@1.11.1 from lock file npm ERR! Missing: acorn@8.8.1 from lock file npm ERR! Missing: acorn-import-assertions@1.8.0 from lock file npm ERR! Missing: browserslist@4.21.4 from lock file npm ERR! Missing: chrome-trace-event@1.0.3 from lock file npm ERR! Missing: enhanced-resolve@5.12.0 from lock file npm ERR! Missing: es-module-lexer@0.9.3 from lock file npm ERR! Missing: eslint-scope@5.1.1 from lock file npm ERR! Missing: events@3.3.0 from lock file npm ERR! Missing: glob-to-regexp@0.4.1 from lock file npm ERR! Missing: graceful-fs@4.2.10 from lock file npm ERR! Missing: json-parse-even-better-errors@2.3.1 from lock file npm ERR! Missing: loader-runner@4.3.0 from lock file npm ERR! Missing: mime-types@2.1.35 from lock file npm ERR! Missing: neo-async@2.6.2 from lock file npm ERR! Invalid: lock file's schema-utils@3.0.0 does not satisfy schema-utils@3.1.1 npm ERR! Missing: tapable@2.2.1 from lock file npm ERR! Missing: terser-webpack-plugin@5.3.6 from lock file npm ERR! Missing: watchpack@2.4.0 from lock file npm ERR! Missing: webpack-sources@3.2.3 from lock file npm ERR! Missing: @types/eslint@8.4.10 from lock file npm ERR! Invalid: lock file's @types/json-schema@7.0.6 does not satisfy @types/json-schema@7.0.11 npm ERR! Missing: @webassemblyjs/helper-numbers@1.11.1 from lock file npm ERR! Missing: @webassemblyjs/helper-wasm-bytecode@1.11.1 from lock file npm ERR! Missing: @webassemblyjs/floating-point-hex-parser@1.11.1 from lock file npm ERR! Missing: @webassemblyjs/helper-api-error@1.11.1 from lock file npm ERR! Missing: @xtuc/long@4.2.2 from lock file npm ERR! Missing: @webassemblyjs/helper-buffer@1.11.1 from lock file npm ERR! Missing: @webassemblyjs/helper-wasm-section@1.11.1 from lock file npm ERR! Missing: @webassemblyjs/wasm-gen@1.11.1 from lock file npm ERR! Missing: @webassemblyjs/wasm-opt@1.11.1 from lock file npm ERR! Missing: @webassemblyjs/wast-printer@1.11.1 from lock file npm ERR! Missing: @webassemblyjs/ieee754@1.11.1 from lock file npm ERR! Missing: @webassemblyjs/leb128@1.11.1 from lock file npm ERR! Missing: @webassemblyjs/utf8@1.11.1 from lock file npm ERR! Missing: @xtuc/ieee754@1.2.0 from lock file npm ERR! Missing: caniuse-lite@1.0.30001441 from lock file npm ERR! Missing: electron-to-chromium@1.4.284 from lock file npm ERR! Missing: node-releases@2.0.8 from lock file npm ERR! Missing: update-browserslist-db@1.0.10 from lock file npm ERR! Missing: esrecurse@4.3.0 from lock file npm ERR! Missing: estraverse@4.3.0 from lock file npm ERR! Missing: estraverse@5.3.0 from lock file npm ERR! Missing: mime-db@1.52.0 from lock file npm ERR! Missing: @jridgewell/trace-mapping@0.3.17 from lock file npm ERR! Missing: jest-worker@27.5.1 from lock file npm ERR! Missing: serialize-javascript@6.0.0 from lock file npm ERR! Missing: terser@5.16.1 from lock file npm ERR! Missing: @jridgewell/resolve-uri@3.1.0 from lock file npm ERR! Missing: @jridgewell/sourcemap-codec@1.4.14 from lock file npm ERR! Missing: @types/node@18.11.18 from lock file npm ERR! Missing: merge-stream@2.0.0 from lock file npm ERR! Missing: supports-color@8.1.1 from lock file npm ERR! Missing: randombytes@2.1.0 from lock file npm ERR! Missing: safe-buffer@5.2.1 from lock file npm ERR! Missing: has-flag@4.0.0 from lock file npm ERR! Missing: @jridgewell/source-map@0.3.2 from lock file npm ERR! Missing: commander@2.20.3 from lock file npm ERR! Missing: source-map-support@0.5.21 from lock file npm ERR! Missing: @jridgewell/gen-mapping@0.3.2 from lock file npm ERR! Missing: @jridgewell/set-array@1.1.2 from lock file npm ERR! Missing: buffer-from@1.1.2 from lock file npm ERR! Missing: source-map@0.6.1 from lock file npm ERR! Missing: escalade@3.1.1 from lock file npm ERR! Missing: picocolors@1.0.0 from lock file npm ERR!
已尝试的无效解决方案:
- 升级至最新版本npm
- 执行
npm config set legacy-peer-deps true
目前唯一可行的解决方案:将npm版本回退至8.5.5。
内容的提问来源于stack exchange,提问作者Carsten Schmitt
相关产品推荐
相关产品推荐

