我的vue项目在我自己的macbook上运行得很好,并且可以成功地进行npm构建。但是当我尝试使用jenkins在我的centos服务器上部署它时,它构建失败了。整个日志都是
ERROR in ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/views/Mark.vue
Module not found: Error: Can't resolve 'Vue-Picture-BD-Marker' in '/app/src/views'
@ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/views/Mark.vue 50:0-49
@ ./src/views/Mark.vue
@ ./src/router/index.js
@ ./src/main.js[39m[22m
Build failed with errors.
有人能帮我吗?我很困惑。非常感谢
当我没有导入vue-picture-bd-marker时,它在我的服务器上成功构建。但是这个模块在我的本地环境中工作得很好。
整个Jenkins的日志就像下面
```Step 1/12 : FROM node:10 as build-stage
---> 28dca6642db8
Step 2/12 : LABEL maintainer="finn"
---> Running in 3a4f55bf5c90
Removing intermediate container 3a4f55bf5c90
---> 1f69f1d2a72d
Step 3/12 : WORKDIR /app
---> Running in 9b3d5d53dbbf
Removing intermediate container 9b3d5d53dbbf
---> 76b3e9a47276
Step 4/12 : COPY . .
---> 67ecea023b88
Step 5/12 : RUN npm config set registry http://registry.npm.taobao.org/
---> Running in 5ee2b9a7017d
Removing intermediate container 5ee2b9a7017d
---> 7612b0801936
Step 6/12 : RUN npm install vue-picture-bd-marker -S
---> Running in 525463f9c177
> core-js@2.6.12 postinstall /app/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
[96mThank you for using core-js ([94m https://github.com/zloirock/core-js [96m) for polyfilling JavaScript standard library![0m
[96mThe project needs your help! Please consider supporting of core-js on Open Collective or Patreon: [0m
[96m>[94m https://opencollective.com/core-js [0m
[96m>[94m https://www.patreon.com/zloirock [0m
[96mAlso, the author of core-js ([94m https://github.com/zloirock [96m) is looking for a good job -)[0m
> ejs@2.7.4 postinstall /app/node_modules/ejs
> node ./postinstall.js
Thank you for installing [35mEJS[0m: built with the [32mJake[0m JavaScript build tool ([32mhttps://jakejs.com/[0m)
> es5-ext@0.10.62 postinstall /app/node_modules/es5-ext
> node -e "try{require('./_postinstall')}catch(e){}" || exit 0
> uglifyjs-webpack-plugin@0.4.6 postinstall /app/node_modules/webpack/node_modules/uglifyjs-webpack-plugin
> node lib/post_install.js
> core-js@3.26.0 postinstall /app/node_modules/vue-picture-bd-marker/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
[96mThank you for using core-js ([94m https://github.com/zloirock/core-js [96m) for polyfilling JavaScript standard library![0m
[96mThe project needs your help! Please consider supporting of core-js:[0m
[96m>[94m https://opencollective.com/core-js [0m
[96m>[94m https://patreon.com/zloirock [0m
[96m>[94m bitcoin: bc1qlea7544qtsmj2rayg0lthvza9fau63ux0fstcz [0m
[96mAlso, the author of core-js ([94m https://github.com/zloirock [96m) is looking for a good job -)[0m
[91mnpm WARN eslint-plugin-vue@7.20.0 requires a peer of eslint@^6.2.0 || ^7.0.0 || ^8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN vue-eslint-parser@7.11.0 requires a peer of eslint@>=5.0.0 but none is installed. You must install peer dependencies yourself.
[0m[91mnpm WARN acorn-jsx@5.3.2 requires a peer of acorn@^6.0.0 || ^7.0.0 || ^8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/webpack-dev-server/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
[0m[91mnpm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
[0m+ vue-picture-bd-marker@1.4.6
added 1357 packages from 718 contributors in 25.494s
80 packages are looking for funding
run `npm fund` for details
Removing intermediate container 525463f9c177
---> f38029d78fba
Step 7/12 : RUN npm install
---> Running in ce44e7ed2964
[91mnpm WARN acorn-jsx@5.3.2 requires a peer of acorn@^6.0.0 || ^7.0.0 || ^8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ajv-keywords@3.5.2 requires a peer of ajv@^6.9.1 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-vue@7.20.0 requires a peer of eslint@^6.2.0 || ^7.0.0 || ^8.0.0 but none is installed. You must install peer dependencies yourself.
[0m[91mnpm WARN style-loader@3.3.1 requires a peer of webpack@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN stylus-loader@7.1.0 requires a peer of stylus@>=0.52.4 but none is installed. You must install peer dependencies yourself.
npm WARN stylus-loader@7.1.0 requires a peer of webpack@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN update-browserslist-db@1.0.10 requires a peer of browserslist@>= 4.21.0 but none is installed. You must install peer dependencies yourself.
[0m[91mnpm WARN vue-eslint-parser@7.11.0 requires a peer of eslint@>=5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
[0m[91mnpm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/webpack-dev-server/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
[0mup to date in 5.824s
80 packages are looking for funding
run `npm fund` for details
Removing intermediate container ce44e7ed2964
---> 9cc90e464d52
Step 8/12 : RUN npm run build
---> Running in 2c230d59bfcd
> drtool-vue@1.0.0 build /app
> node build/build.js
Hash: [1m403f85fa3eac2561beea[39m[22m
Version: webpack [1m3.12.0[39m[22m
Time: [1m27286[39m[22mms
[1mAsset[39m[22m [1mSize[39m[22m [1mChunks[39m[22m [1m[39m[22m [1m[39m[22m [1mChunk Names[39m[22m
[1m[32mstatic/css/app.973c70332ba0b7777e4e169660c4c590.css[39m[22m 241 kB [1m1[39m[22m [1m[32m[emitted][39m[22m app
[1m[32mstatic/fonts/element-icons.535877f.woff[39m[22m 28.2 kB [1m[39m[22m [1m[32m[emitted][39m[22m
[1m[33mstatic/js/vendor.30f6ae5de4596c007430.js[39m[22m [1m[33m1.13 MB[39m[22m [1m0[39m[22m [1m[32m[emitted][39m[22m [1m[33m[big][39m[22m vendor
[1m[32mstatic/js/app.07da158772daae0903c6.js[39m[22m 1.75 kB [1m1[39m[22m [1m[32m[emitted][39m[22m app
[1m[32mstatic/js/manifest.2ae2e69a05c33dfc65f8.js[39m[22m 857 bytes [1m2[39m[22m [1m[32m[emitted][39m[22m manifest
[1m[32mstatic/fonts/element-icons.732389d.ttf[39m[22m 56 kB [1m[39m[22m [1m[32m[emitted][39m[22m
[1m[32mstatic/css/app.973c70332ba0b7777e4e169660c4c590.css.map[39m[22m 342 kB [1m[39m[22m [1m[32m[emitted][39m[22m
[1m[32mstatic/js/vendor.30f6ae5de4596c007430.js.map[39m[22m 4.38 MB [1m0[39m[22m [1m[32m[emitted][39m[22m vendor
[1m[32mstatic/js/app.07da158772daae0903c6.js.map[39m[22m 10.2 kB [1m1[39m[22m [1m[32m[emitted][39m[22m app
[1m[32mstatic/js/manifest.2ae2e69a05c33dfc65f8.js.map[39m[22m 4.97 kB [1m2[39m[22m [1m[32m[emitted][39m[22m manifest
[1m[32mindex.html[39m[22m 512 bytes [1m[39m[22m [1m[32m[emitted][39m[22m
[1m[31mERROR in ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/views/Mark.vue
Module not found: Error: Can't resolve 'Vue-Picture-BD-Marker' in '/app/src/views'
@ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/views/Mark.vue 50:0-49
@ ./src/views/Mark.vue
@ ./src/router/index.js
@ ./src/main.js[39m[22m
Build failed with errors.
[91mnpm ERR! code ELIFECYCLE
npm ERR! errno 1
[0m[91mnpm ERR! drtool-vue@1.0.0 build: `node build/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the drtool-vue@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[0m[91m
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-11-02T03_52_20_178Z-debug.log
[0mThe command '/bin/sh -c npm run build' returned a non-zero code: 1
d482ed42ced2
c5d0729d1568fec712980310990231e89792457807078e48bc6a9c265ca95c71
Finished: SUCCESS
1条答案
按热度按时间biswetbf1#
我能够通过将
import {AIMarker} from "Vue-Picture-BD-Marker"
替换为import {AIMarker} from "vue-picture-bd-marker"
来解决这个问题。注意,macos或windows对大小写不敏感,但linux敏感。