npm -如果使用docker运行,则找不到模块
我正在尝试使用docker运行我的vue应用程序。在本地更新npm包后,我得到以下错误:
- Building for production...
ERROR Failed to compile with 1 error8:17:57 AM
This relative module was not found:
* ../internals/a-function in ./node_modules/core-js/internals/new-promise-capability.js
ERROR Build failed with errors.
在Windows下,一切工作正常。我已经尝试添加最新的package.json -js模块并将核心恢复到稳定状态,但没有成功。我不知道我错过了什么。
我的Dockerfile:
# develop stage
FROM node:lts-alpine as develop-stage
WORKDIR /app
COPY app/package*.json ./
RUN npm install
COPY app/. .
# build stage
FROM develop-stage as build-stage
RUN npm run build
# production stage
FROM nginx:alpine as production-stage
COPY --from=build-stage /app/dist /usr/share/nginx/html
EXPOSE 90
CMD ["nginx", "-g", "daemon off;"]
我的package.json:
{
"name": "frontend",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.36",
"@fortawesome/free-solid-svg-icons": "^5.15.4",
"@fortawesome/vue-fontawesome": "^2.0.6",
"@growthbunker/vuedarkmode": "^0.5.56",
"axios": "^0.21.4",
"colormap": "^2.3.2",
"core-js": "^3.18.2",
"json-loader": "^0.5.7",
"numeral": "^2.0.6",
"prismjs": "^1.25.0",
"pvw-visualizer": "^3.2.2",
"splitpanes": "^2.3.8",
"vue": "^2.6.11",
"vue-json-editor": "^1.4.3",
"vue-json-pretty": "^1.8.1",
"vue-numeral-filter": "^2.0.0",
"vue-numerals": "^4.0.6",
"vue-plotly": "^1.1.0",
"vue-prism-editor": "^1.3.0",
"vue-remote-component": "^1.4.0",
"vue-vtk-js": "^1.1.6",
"vuescroll": "^4.17.3",
"vuetify": "^2.5.10",
"yaml-loader": "^0.6.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.5.14",
"@vue/cli-plugin-eslint": "^4.5.14",
"@vue/cli-service": "^4.5.14",
"babel-eslint": "^10.1.0",
"eslint": "^6.8.0",
"eslint-plugin-html": "^6.2.0",
"eslint-plugin-vue": "^7.19.1",
"sass": "~1.32.0",
"sass-loader": "^10.0.0",
"vue-cli-plugin-vuetify": "^2.4.3",
"vue-template-compiler": "^2.6.11",
"vuetify-loader": "^1.7.3"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}
转载请注明出处:http://www.lishuoershouche.com/article/20230401/1695613.html
随机推荐
-
npm:在jenkins代理上找不到,但可以通过ssh获得。
我正在尝试建立一个使用多个代理的jenkins管道。这些代理是生活在云租户(openstack)中的ubuntu实例。当我试图在一些实例上运行一些npm命令时,我得到了错误npm: not found。我已经读了很多其他的帖子,但我很难理解...
-
npm 和 maven 使用 Nexus3 私服 | 前后端一起学
前文《Docker 搭建 Nexus3 私服 》介绍了在 docker 环境下安装 nexus3 以及 nexus3 的基本操作和管理,本文分别介绍 npm(前端)和 maven(后端)如何使用 nexus3 作为私服。文中的 demo ...
-
npm run dev 总是自动运行浏览器,怎么关闭?
百度了好久都是说: 修改 config/index.js 里面的此属性:autoOpenBrowser: false, (毫无作用,依然还是运行就自动打开!) 解决: npm run dev 时候执行的是build/dev-server....
-
npm如果我没有使用GitHub,如何提交package-lock.json
我使用npm install npm@latest -g命令行更新了npm,我既没有使用github,也没有使用任何其他命令,我得到的消息是created a NodeJS file as package-lock.json. You sh...
-
npm:在Electron应用程序中执行命令时找不到命令
我正在开发一个电子应用程序,在该应用程序中,我使用child_process.exec执行外壳命令。我运行的命令之一是npm run start;这在开发环境中工作得很好,但是当我为生产环境构建应用程序时,所有的npm命令都会失败,并显示以...
-
Npm install引入了软件包,但成功(?)后找不到它们。安装
我正在尝试npm为一个项目安装一个包(jasmine)。这个包似乎安装得很好,但是当我尝试使用它时,我遇到了一个error message。我正在全局安装这个包,所以它应该是可访问的,并且我可以在my node modules folder...
-
npm 安装扩展模块时,因缓存报错的问题汇总
1、缓存报错问题一 : unexpected end of file 解决方法:运行:npm cache verify 清除缓存 2、缓存报错问题二 : errno -4048(网上一般说是权限问题,其实不是,还是因为缓存问题) 解决...
-
npm : 无法加载文件 D:\Program Files\nodejs\node_global\npm.ps1,因为在此系统上禁止运行脚本。
npm : 无法加载文件 D:\Program Files\nodejs\node_global\npm.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https: /go.microsoft.com/fwlink/?Lin...
-
Npm安装使用docker buildx linux/arm64失败
我正在为部署服务器arm64从x86_64机器上构建一个docker镜像。为了测试,我使用了下面的docker文件。FROM node:14.16.0-buster RUN npm install pm2@latest -g复制由于某些原...
-
npm express找不到中间件
我已经安装了npm express和serve-flavicon,它们出现在npm ls和npm ls --global中,但我仍然得到了Error: Most middleware (like favicon) is no longer ...