nuxt-seo
nuxt-seo copied to clipboard
unable to use within docker container
Describe the bug
Hey,
We implemented this module with our app and it worked great locally but when we needed to deploy to production via docker, our CI failed ( see docker build logs below for a fresh project with only seo module installed ) to build the image.
x64 linux host
Sending build context to Docker daemon 135.7kB
Step 1/6 : FROM node:20-alpine
---> ae7f6c370720
Step 2/6 : COPY / /
---> 58565d83a83e
Step 3/6 : RUN npm install -g pnpm
---> Running in b71f2229b305
added 1 package in 781ms
1 package is looking for funding
run `npm fund` for details
npm notice
npm notice New minor version of npm available! 10.2.4 -> 10.5.0
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.5.0>
npm notice Run `npm install -g [email protected]` to update!
npm notice
Removing intermediate container b71f2229b305
---> 9d255473a93c
Step 4/6 : WORKDIR "/"
---> Running in 598c786369e6
Removing intermediate container 598c786369e6
---> 49a6fe9737e1
Step 5/6 : RUN pnpm install
---> Running in 167d1ca5418d
Progress: resolved 1, reused 0, downloaded 0, added 0
Progress: resolved 968, reused 0, downloaded 884, added 0
Packages: +928
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 1012, reused 0, downloaded 928, added 585
Progress: resolved 1012, reused 0, downloaded 928, added 928, done
.../fontawesome-common-types postinstall$ node attribution.js
.../node_modules/vue-demi postinstall$ node -e "try{require('./scripts/postinstall.js')}catch(e){}"
.../fontawesome-common-types postinstall: Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com
.../fontawesome-common-types postinstall: License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
.../fontawesome-common-types postinstall: Copyright 2023 Fonticons, Inc.
.../fontawesome-common-types postinstall: Done
.../node_modules/vue-demi postinstall: Done
.../@fortawesome/free-regular-svg-icons postinstall$ node attribution.js
.../@fortawesome/free-solid-svg-icons postinstall$ node attribution.js
.../[email protected]/node_modules/esbuild postinstall$ node install.js
.../[email protected]/node_modules/esbuild postinstall$ node install.js
.../@fortawesome/free-solid-svg-icons postinstall: Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com
.../@fortawesome/free-solid-svg-icons postinstall: License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
.../@fortawesome/free-solid-svg-icons postinstall: Copyright 2023 Fonticons, Inc.
.../@fortawesome/free-regular-svg-icons postinstall: Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com
.../@fortawesome/free-regular-svg-icons postinstall: License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
.../@fortawesome/free-regular-svg-icons postinstall: Copyright 2023 Fonticons, Inc.
.../@fortawesome/free-solid-svg-icons postinstall: Done
.../@fortawesome/free-regular-svg-icons postinstall: Done
.../[email protected]/node_modules/esbuild postinstall: Done
.../[email protected]/node_modules/esbuild postinstall: Done
.../node_modules/json-editor-vue preinstall$ node -e "if (process.env.INIT_CWD === process.cwd()) { process.exit(1) }" || npx only-allow pnpm
.../node_modules/json-editor-vue preinstall: Done
.../node_modules/json-editor-vue postinstall$ node -e "if (process.env.INIT_CWD === process.cwd()) { process.exit(1) }" || npx simple-git-hooks
.../node_modules/json-editor-vue postinstall: Done
> nuxt-app@ postinstall /
> nuxt prepare
ERROR Cannot find matching package.json in / or parent directories
at findFile (/node_modules/.pnpm/[email protected]/node_modules/pkg-types/dist/index.mjs:45:9)
ERROR Cannot find matching package.json in / or parent directories
ELIFECYCLE Command failed with exit code 1.
The command '/bin/sh -c pnpm install' returned a non-zero code: 1
arm64 m2 mac
=> ERROR [5/6] RUN pnpm build 0.8s
------
> [5/6] RUN pnpm build:
0.337
0.337 > nuxt-app@ build /
0.337 > nuxt build
0.337
0.482 Nuxt 3.11.0
0.801
0.801 ERROR Cannot find module @rollup/rollup-linux-arm64-musl. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try npm i again after removing both package-lock.json and node_modules directory.
0.801
0.801 at requireWithFriendlyError (/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/native.js:87:9)
0.801 at Object.<anonymous> (/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/native.js:96:76)
0.801 at Module._compile (node:internal/modules/cjs/loader:1376:14)
0.801 at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
0.801 at Module.load (node:internal/modules/cjs/loader:1207:32)
0.801 at Module._load (node:internal/modules/cjs/loader:1023:12)
0.801 at cjsLoader (node:internal/modules/esm/translators:356:17)
0.801 at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:305:7)
0.801 at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
0.801 at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
0.801
0.801
0.801
0.801 ERROR Cannot find module @rollup/rollup-linux-arm64-musl. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try npm i again after removing both package-lock.json and node_modules directory.
0.801
0.806 ELIFECYCLE Command failed with exit code 1.
------
Dockerfile:6
--------------------
4 | WORKDIR "/"
5 | RUN pnpm install
6 | >>> RUN pnpm build
7 |
--------------------
ERROR: failed to solve: process "/bin/sh -c pnpm build" did not complete successfully: exit code: 1
The Dockerfile in essence
FROM node:20-alpine
COPY / /
RUN npm install -g pnpm
WORKDIR "/"
RUN pnpm install
RUN pnpm build
Reproduction
create fresh nuxt project, add seo and try to build with docker
System / Nuxt Info
node:20-alpine image (tried different versions and distros)
fresh nuxt 3.11 project with seo module added