赞
踩
进入前端模块根目录下执行构建命令:
npm run build:prod
由于没有安装依赖包,所以提示如下:
> osap-system-ui@4.4.0 build:prod
> vue-cli-service build
'vue-cli-service' 不是内部或外部命令,也不是可运行的程序或批处理文件。
安装依赖:
npm install
报错如下:
npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: supervision-web@4.4.0 npm ERR! Found: vue@2.6.10 npm ERR! node_modules/vue npm ERR! vue@"2.6.10" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer vue@"^3.0.0" from @tinymce/tinymce-vue@4.0.4 npm ERR! node_modules/@tinymce/tinymce-vue npm ERR! @tinymce/tinymce-vue@"^4.0.3" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution. npm ERR! npm ERR! See C:\Users\12547\AppData\Local\npm-cache\eresolve-report.txt for a full report. npm ERR! A complete log of this run can be found in: xxx-debug.log
按照错误提示输入如下命令:
npm i --legacy-peer-deps
仍然报错如下:
npm WARN EBADENGINE Unsupported engine { npm WARN EBADENGINE package: 'pkcs7@0.2.3', npm WARN EBADENGINE required: { npm: '^1.4.6', node: '^0.10' }, npm WARN EBADENGINE current: { node: 'v14.2.0', npm: '7.9.0' } npm WARN EBADENGINE } npm WARN deprecated har-validator@5.1.5: this library is no longer supported npm WARN deprecated tsml@1.0.1: no longer maintained npm WARN deprecated sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead. npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies. npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated npm WARN deprecated nomnom@1.8.1: Package no longer supported. Contact support@npmjs.com for more info. npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js. npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142 npm WARN deprecated left-pad@1.3.0: use String.prototype.padStart() npm WARN deprecated @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained npm WARN deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address' npm WARN deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained npm WARN deprecated @hapi/joi@15.1.1: Switch to 'npm install joi' npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies. npm WARN deprecated eslint-loader@2.2.1: This loader has been deprecated. Please use eslint-webpack-plugin npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js. npm WARN deprecated highlight.js@9.18.5: Support has ended for 9.x series. Upgrade to @latest npm WARN deprecated html-webpack-plugin@3.2.0: 3.x is no longer supported npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates. npm WARN deprecated axios@0.18.1: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410 npm WARN deprecated chokidar@2.1.5: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies. npm ERR! cb() never called! npm ERR! This is an error with npm itself. Please report this error at: npm ERR! <https://github.com/npm/cli/issues> npm ERR! A complete log of this run can be found in: xxx-debug.log
怀疑可能是 npm 版本低的原因,查看版本:
npm -v
7.9.0
更新 npm 版本:
npm install -g npm
使用淘宝镜像重新安装依赖:
npm install --registry=https://registry.npm.taobao.org
安装淘宝的 cnpm:
npm install -g cnpm --registry=https://registry.npm.taobao.org
使用 cnpm 进行构建则成功:
cnpm run build:prod
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。