- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试在 Docker 中运行 Nuxt.js 应用程序。我已经像这样设置了我的 Dockerfile:
FROM node:10.15.1 as base
WORKDIR /usr/src/app
COPY package.json ./
ENV HOST 0.0.0.0
FROM base as development
RUN npm install
COPY . .
ENV NODE_ENV development
EXPOSE 3000
CMD [ "npm", "run", "dev" ]
还有我的 docker-compose.yml:
version: "3.7"
services:
frontend:
container_name: frontend
restart: unless-stopped
build:
context: .
target: development
volumes:
- .:/usr/src/app
- /usr/src/app/node_modules
ports:
- "3000:3000"
当我运行docker-compose up
时,我得到了
frontend | These dependencies were not found: friendly-errors 10:52:33
frontend | friendly-errors 10:52:33
frontend | * core-js/modules/es6.array.find in ./.nuxt/client.js friendly-errors 10:52:33
frontend | * core-js/modules/es6.array.iterator in ./.nuxt/client.js
frontend | * core-js/modules/es6.date.to-string in ./.nuxt/utils.js
frontend | * core-js/modules/es6.function.name in ./.nuxt/client.js
frontend | * core-js/modules/es6.object.assign in ./.nuxt/client.js
frontend | * core-js/modules/es6.object.keys in ./.nuxt/utils.js friendly-errors 10:52:33
frontend | * core-js/modules/es6.promise in ./.nuxt/client.js friendly-errors 10:52:33
frontend | * core-js/modules/es6.regexp.constructor in ./.nuxt/utils.js
frontend | * core-js/modules/es6.regexp.match in ./.nuxt/client.js
frontend | * core-js/modules/es6.regexp.replace in ./.nuxt/middleware.js
frontend | * core-js/modules/es6.regexp.search in ./.nuxt/utils.js
frontend | * core-js/modules/es6.regexp.split in ./.nuxt/utils.js
frontend | * core-js/modules/es6.regexp.to-string in ./.nuxt/utils.js
frontend | * core-js/modules/es6.string.includes in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.client.js
frontend | * core-js/modules/es6.string.iterator in ./.nuxt/utils.js
frontend | * core-js/modules/es6.string.repeat in ./.nuxt/utils.js
frontend | * core-js/modules/es6.string.starts-with in ./.nuxt/utils.js
frontend | * core-js/modules/es6.symbol in ./.nuxt/middleware.js, ./.nuxt/components/nuxt-link.client.js
frontend | * core-js/modules/es7.array.includes in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.client.js
frontend | * core-js/modules/es7.promise.finally in ./.nuxt/client.js
frontend | * core-js/modules/es7.symbol.async-iterator in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.client.js
frontend | * core-js/modules/web.dom.iterable in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.client.js
frontend | friendly-errors 10:52:33
frontend | To install them, you can run: npm install --save core-js/modules/es6.array.find core-js/modules/es6.array.iterator core-js/modules/es6.date.to-string core-js/modules/es6.function.name core-js/modules/es6.object.assign core-js/modules/es6.object.keys core-js/modules/es6.promise core-js/modules/es6.regexp.constructor core-js/modules/es6.regexp.match core-js/modules/es6.regexp.replace core-js/modules/es6.regexp.search core-js/modules/es6.regexp.split core-js/modules/es6.regexp.to-string core-js/modules/es6.string.includes core-js/modules/es6.string.iterator core-js/modules/es6.string.repeat core-js/modules/es6.string.starts-with core-js/modules/es6.symbol core-js/modules/es7.array.includes core-js/modules/es7.promise.finally core-js/modules/es7.symbol.async-iterator core-js/modules/web.dom.iterable
frontend | ℹ Waiting for file changes 10:52:33
frontend |
frontend | READY Server listening on http://0.0.0.0:3000 10:52:33
frontend |
我的项目在没有 docker 的情况下工作正常,而且我在另一个 Vue 项目(不是 Nuxt)中使用几乎相同的 Dockerfile。经过一番研究,我找到了一个将 @babel/polyfill 添加到我的依赖项中的解决方案。但是当我这样做时,它会提示下一个缺少的依赖项,所以我猜 Nuxt 安装的所有依赖项都丢失了。而且这并不能解释为什么它在没有 Docker 的情况下运行。
当我运行 docker-compose run sh
进入 shell,然后运行 ls -lah
列出所有文件时:
-rw-r--r-- 1 root root 32 Feb 1 13:48 .dockerignore
-rw-r--r-- 1 root root 1.1K Feb 1 13:23 .eslintrc.js
drwxr-xr-x 10 root root 320 Feb 2 09:17 .git
-rw-r--r-- 1 root root 1.2K Feb 1 13:01 .gitignore
drwxr-xr-x 14 root root 448 Feb 2 10:52 .nuxt
-rw-r--r-- 1 root root 334 Feb 2 10:51 Dockerfile
-rw-r--r-- 1 root root 370 Feb 1 13:01 README.md
drwxr-xr-x 3 root root 96 Feb 1 13:01 assets
drwxr-xr-x 4 root root 128 Feb 1 13:01 components
drwxr-xr-x 4 root root 128 Feb 1 13:01 layouts
drwxr-xr-x 3 root root 96 Feb 1 13:01 middleware
drwxr-xr-x 798 root root 32K Feb 2 10:56 node_modules
-rw-r--r-- 1 root root 1.7K Feb 1 13:45 nuxt.config.js
-rw-r--r-- 1 root root 363K Feb 1 13:19 package-lock.json
-rw-r--r-- 1 root root 612 Feb 2 10:06 package.json
drwxr-xr-x 4 root root 128 Feb 1 13:01 pages
drwxr-xr-x 4 root root 128 Feb 1 13:01 plugins
drwxr-xr-x 3 root root 96 Feb 1 13:01 server
drwxr-xr-x 4 root root 128 Feb 1 13:01 static
drwxr-xr-x 3 root root 96 Feb 1 13:01 store
我看到 node_modules
和 .nuxt
目录存在。 core-js
包也存在于 node_modules
中。
有什么想法吗?
最佳答案
我也遇到了同样的问题。我用
解决了这个问题npm 我 core-js@2.6.5
我认为有一个 nuxt 依赖项正在使用旧的 core-js 版本,而这个依赖项会产生此错误。
我在我的 package-lock.json 中找到了这个
"@nuxt/babel-preset-app": {
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/@nuxt/babel-preset-app/-/babel-preset-app-2.5.1.tgz",
"requires": {
"@babel/core": "^7.4.0",
"@babel/plugin-proposal-class-properties": "^7.4.0",
"@babel/plugin-proposal-decorators": "^7.4.0",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.4.0",
"@babel/preset-env": "^7.4.2",
"@babel/runtime": "^7.4.2",
"@vue/babel-preset-jsx": "^1.0.0-beta.2",
"core-js": "^2.6.5"
},
"dependencies": {
"core-js": {
"version": "2.6.5",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.5.tgz",
}
}
},
关于node.js - Docker 中的 Nuxt.js : missing dependencies,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54492385/
我从这里复制了一些文件:https://codesandbox.io/s/github/nuxt/nuxt.js/tree/dev/examples/custom-loading?from-embed
我已经在整个互联网上搜索了我的问题的答案。到目前为止没有运气。 我想要达到的目标: 我有一个在通用模式下运行的 Nuxt 应用程序。它类似于一个小型社交网络,用户可以在其中创建自己的个人资料并分享他们
在我的 nuxt 应用程序中,嵌套目录中的组件不会按预期自动导入。对于我的一些组件,我有如下内容:vue 2.6.12 , nuxt 2.15.0components\目录结构 TopArea\ --
我有点困惑,因为在官方 nuxt 网站上它说当前的 nuxt 版本是 2.5.X 但是当我使用 npx create-nuxt-app 创建 nuxt 应用程序时并检查 package.json在依赖
我有survey-vue(surveyJS)在dev上运行良好,但是当我尝试部署时,登陆带有调查组件的页面时出现最大调用堆栈大小超出错误。 我在想这就是我导入插件的方式,但我不确定。 插件/surve
我有如下路径 路径:'/board/:type(\d{2}):subtype(\d{2}):id(\d+)' 所以这是这样的 http://localhost:3000/board/112233333
我构建多应用 Nuxt 项目,这些应用之间不直接通信。每个应用程序都有自己的商店,我想为共享商店使用一个目录。我将这种方法用于组件并且效果很好。 |-> app1 | |-> store // s
将我的 nuxt-cli 版本升级到 2.15.3 后,我注意到页面 block 的大小减小了,所有 node_modules 安装的包现在都被捆绑到现在变得越来越大的 app.js 中。 在下面你可
我正在使用 nuxt 生成完整的静态 Web 应用程序,如下所述 https://nuxtjs.org/blog/going-full-static/#crazy-fast-static-applic
我已经看到很多与此主题相关的问题。但是他们都没有解决我的问题。 我有一个情况,我必须检查 innerWidth窗口,使用 isMobile 检查设备是否可移动多变的。 ...
我在最新版本的 Vuetify 中使用 NuxtJs。 在我的导航栏中有一个通向主页的主页按钮,这是它的代码: mdi-home 只要我在主页上,图标就会悬停: 一旦
我有一个登录页面,我希望登录的用户无法看到。我的组件如下: ... ... @Component({ layout: 'fullWidth', auth: '
我正在创建一个插件,它将发出由套接字触发的基本 nuxt 事件。然后将收到 nuxt 事件并打开一个 snackbar 。在组件内部时,使用 $nuxt 可以轻松发送和接收事件。 this.$nuxt
我有一个Composable,它返回一个函数,在5秒的间隔内验证身份验证和刷新令牌。两者都利用Nuxt的useCookie实用程序函数来执行其背后的逻辑。。起初,它是有效的。但有时,当令牌到期时,它会
我不能在这里使用 window.location,因为它是 SSR 应用程序。useRouter、useRoute 和 useNuxtApp 也没有域名。nuxtApp.ssrContext 未定义。
我在 nuxt.js 上有前端服务器,在带有 django-rest-framework 的 django 中有后端。谁能给我一个使用 nuxt-auth 本地策略刷新 jwt token 的例子?我
有很多关于 Nuxt SSR 或全静态的信息,但我找不到任何指南如何构建具有静态页面的混合 SSR。 我正在使用 Nuxt SSR 构建一个网站,我想从一个 10MB 的 JSON 文件静态预渲染所有
我在本地构建了nuxt js的项目,即npm run build,然后将项目推送到.nuxt文件夹,而不是node_modules文件夹。然后运行npm run start命令,失败。 输出信息:sh
我有一个 NUXT 项目,我正在尝试添加 301 重定向。我尝试了几种不同的方法,但没有任何效果。如果我转到旧 URL,我会得到一个 404 页面。 向 Nuxt 项目添加重定向的最佳方式是什么? 任
我正在使用 Nuxt Content存储应用程序内容(JSON 文件)。它在热重载的开发模式下工作很酷。我网站的后端更改内容文件夹中的任何文件,并且这会立即在浏览器中更改而无需重新加载页面。但在生产模
我是一名优秀的程序员,十分优秀!