image icon indicating copy to clipboard operation
image copied to clipboard

SSR build failing on Vercel with error Cannot find module 'sharp'

Open riccardolardi opened this issue 2 years ago • 10 comments

SSR build failing on Vercel with error Cannot find module 'sharp'

Probably related to https://github.com/nuxt/image/issues/430

Using this vercel.json:

{
  "version": 2,
  "routes": [
    {
      "src": "/api/subscribe",
      "dest": "/api/subscribe.js"
    }
  ],
  "builds": [
    {
      "src": "api/**/*.js",
      "use": "@vercel/node"
    },
    {
      "src": "nuxt.config.js",
      "use": "@nuxtjs/vercel-builder",
      "config": {
        "serverFiles": [
          "project.config.js",
          "api/**"
        ]
      }
    }
  ]
}

Here is the complete build log:

15:38:32.209 | Cloning github.com/riccardolardi/garcoa-nuxt (Branch: master, Commit: fb74248)
-- | --
15:38:33.292 | Cloning completed: 1.082s
15:38:33.323 | Analyzing source code...
15:38:33.336 | Warning: Due to `builds` existing in your configuration file, the Build and Development Settings defined in your Project Settings will not apply. Learn More: https://vercel.link/unused-build-settings
15:38:34.633 | Installing build runtime...
15:38:35.399 | Build runtime installed: 765.535ms
15:38:36.562 | Installing build runtime...
15:38:39.779 | Build runtime installed: 3.217s
15:38:42.736 | Looking up build cache...
15:38:45.017 | Build cache downloaded [31.16 MB]: 2071.738ms
15:38:46.536 | Installing dependencies...
15:38:46.850 | yarn install v1.22.11
15:38:46.892 | info No lockfile found.
15:38:46.903 | [1/4] Resolving packages...
15:38:52.415 | warning @nuxtjs/svg > vue-svg-loader > svg-to-vue > [email protected]: This SVGO version is no longer supported. Upgrade to v2.x.x.
15:38:52.530 | warning [email protected]: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
15:38:53.579 | warning mailchimp-api-v3 > [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
15:38:53.609 | warning mailchimp-api-v3 > request > [email protected]: this library is no longer supported
15:38:53.636 | warning mailchimp-api-v3 > request > [email protected]: 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.
15:38:55.494 | warning nuxt > @nuxt/babel-preset-app > [email protected]: 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.
15:38:56.625 | warning nuxt > @nuxt/webpack > webpack-hot-middleware > [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
15:38:56.852 | warning nuxt > @nuxt/webpack > cssnano > cssnano-preset-default > postcss-svgo > [email protected]: This SVGO version is no longer supported. Upgrade to v2.x.x.
15:38:57.060 | warning nuxt > @nuxt/webpack > webpack > node-libs-browser > url > [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
15:38:57.061 | warning nuxt > @nuxt/webpack > webpack > watchpack > watchpack-chokidar2 > [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
15:38:57.064 | warning nuxt > @nuxt/webpack > webpack > watchpack > watchpack-chokidar2 > chokidar > [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
15:38:57.192 | warning nuxt > @nuxt/webpack > postcss-preset-env > postcss-color-hex-alpha > postcss-values-parser > [email protected]: flatten is deprecated in favor of utility frameworks such as lodash.
15:38:57.334 | warning nuxt > @nuxt/webpack > webpack > micromatch > snapdragon > source-map-resolve > [email protected]: https://github.com/lydell/resolve-url#deprecated
15:38:57.337 | warning nuxt > @nuxt/webpack > webpack > micromatch > snapdragon > source-map-resolve > [email protected]: Please see https://github.com/lydell/urix#deprecated
15:38:58.513 | [2/4] Fetching packages...
15:39:22.324 | info [email protected]: The platform "linux" is incompatible with this module.
15:39:22.324 | info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
15:39:22.329 | info [email protected]: The platform "linux" is incompatible with this module.
15:39:22.330 | info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
15:39:22.336 | [3/4] Linking dependencies...
15:39:22.341 | warning "@nuxtjs/eslint-config > eslint-plugin-jest > @typescript-eslint/experimental-utils > @typescript-eslint/typescript-estree > [email protected]" has unmet peer dependency "typescript@>=2.8.0 \|\| >= 3.2.0-dev \|\| >= 3.3.0-dev \|\| >= 3.4.0-dev \|\| >= 3.5.0-dev \|\| >= 3.6.0-dev \|\| >= 3.6.0-beta \|\| >= 3.7.0-dev \|\| >= 3.7.0-beta".
15:39:22.342 | warning "@nuxtjs/eslint-module > [email protected]" has unmet peer dependency "webpack@^4.0.0 \|\| ^5.0.0".
15:39:22.342 | warning "@nuxtjs/moment > [email protected]" has unmet peer dependency "webpack@^1 \|\| ^2 \|\| ^3 \|\| ^4 \|\| ^5".
15:39:22.342 | warning "@nuxtjs/moment > [email protected]" has unmet peer dependency "[email protected] \|\| 5.x.x".
15:39:22.343 | warning "@nuxtjs/stylelint-module > [email protected]" has unmet peer dependency "webpack@^4.0.0 \|\| ^5.0.0".
15:39:22.343 | warning "@nuxtjs/svg > [email protected]" has unmet peer dependency "webpack@^4.0.0 \|\| ^5.0.0".
15:39:22.343 | warning "@nuxtjs/svg > [email protected]" has unmet peer dependency "webpack@^4.0.0 \|\| ^5.0.0".
15:39:22.343 | warning "@nuxtjs/svg > [email protected]" has unmet peer dependency "webpack@^4.0.0 \|\| ^5.0.0".
15:39:22.344 | warning "@nuxtjs/svg > [email protected]" has unmet peer dependency "vue-template-compiler@^2.0.0".
15:39:22.344 | warning "@nuxtjs/svg > vue-svg-loader > [email protected]" has unmet peer dependency "vue-template-compiler@^2.0.0".
15:39:22.344 | warning "nuxt > @nuxt/[email protected]" has unmet peer dependency "consola@*".
15:39:22.351 | warning " > [email protected]" has unmet peer dependency "webpack@^4.36.0 \|\| ^5.0.0".
15:39:22.352 | warning " > [email protected]" has incorrect peer dependency "swiper@^5.2.0".
15:39:22.352 | warning " > [email protected]" has unmet peer dependency "[email protected]".
15:39:33.446 | [4/4] Building fresh packages...
15:39:35.628 | success Saved lockfile.
15:39:35.633 | Done in 48.79s.
15:39:38.173 | Uploading build outputs...
15:39:39.590 | Deploying build outputs...
15:39:43.489 | Looking up build cache...
15:39:54.729 | Build cache downloaded [212.60 MB]: 11064.510ms
15:39:56.063 | [log] Running with @nuxt/vercel-builder version 0.22.1
15:39:56.064 | [log]  ----------------- Prepare build -----------------
15:39:56.064 | [log] Downloading files...
15:39:56.064 | [log] Working directory: /vercel/path1
15:39:56.069 | [log] Using yarn
15:39:56.070 | [info] Prepare build took: 6.384821 ms
15:39:56.070 | [log]  ----------------- Install devDependencies -----------------
15:39:56.070 | [log] Using cached node_modules_dev
15:39:58.167 | yarn install v1.22.11
15:39:58.295 | [1/5] Resolving packages...
15:39:59.011 | [2/5] Fetching packages...
15:40:01.050 | info [email protected]: The platform "linux" is incompatible with this module.
15:40:01.050 | info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
15:40:01.064 | info [email protected]: The platform "linux" is incompatible with this module.
15:40:01.064 | info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
15:40:01.070 | [3/5] Linking dependencies...
15:40:01.075 | warning "@nuxtjs/eslint-config > eslint-plugin-jest > @typescript-eslint/experimental-utils > @typescript-eslint/typescript-estree > [email protected]" has unmet peer dependency "typescript@>=2.8.0 \|\| >= 3.2.0-dev \|\| >= 3.3.0-dev \|\| >= 3.4.0-dev \|\| >= 3.5.0-dev \|\| >= 3.6.0-dev \|\| >= 3.6.0-beta \|\| >= 3.7.0-dev \|\| >= 3.7.0-beta".
15:40:01.076 | warning "@nuxtjs/eslint-module > [email protected]" has unmet peer dependency "webpack@^4.0.0 \|\| ^5.0.0".
15:40:01.076 | warning "@nuxtjs/moment > [email protected]" has unmet peer dependency "webpack@^1 \|\| ^2 \|\| ^3 \|\| ^4 \|\| ^5".
15:40:01.076 | warning "@nuxtjs/moment > [email protected]" has unmet peer dependency "[email protected] \|\| 5.x.x".
15:40:01.076 | warning "@nuxtjs/stylelint-module > [email protected]" has unmet peer dependency "webpack@^4.0.0 \|\| ^5.0.0".
15:40:01.077 | warning "@nuxtjs/svg > [email protected]" has unmet peer dependency "webpack@^4.0.0 \|\| ^5.0.0".
15:40:01.077 | warning "@nuxtjs/svg > [email protected]" has unmet peer dependency "webpack@^4.0.0 \|\| ^5.0.0".
15:40:01.077 | warning "@nuxtjs/svg > [email protected]" has unmet peer dependency "webpack@^4.0.0 \|\| ^5.0.0".
15:40:01.077 | warning "@nuxtjs/svg > [email protected]" has unmet peer dependency "vue-template-compiler@^2.0.0".
15:40:01.077 | warning "@nuxtjs/svg > vue-svg-loader > [email protected]" has unmet peer dependency "vue-template-compiler@^2.0.0".
15:40:01.078 | warning "nuxt > @nuxt/[email protected]" has unmet peer dependency "consola@*".
15:40:01.088 | warning " > [email protected]" has unmet peer dependency "webpack@^4.36.0 \|\| ^5.0.0".
15:40:01.092 | warning " > [email protected]" has incorrect peer dependency "swiper@^5.2.0".
15:40:01.092 | warning " > [email protected]" has unmet peer dependency "[email protected]".
15:40:06.298 | [4/5] Building fresh packages...
15:40:09.694 | warning Error running install script for optional dependency: "/vercel/path1/node_modules/sharp: Command failed.
15:40:09.694 | Exit code: 1
15:40:09.695 | Command: (node install/libvips && node install/dll-copy && prebuild-install) \|\| (node install/can-compile && node-gyp rebuild && node install/dll-copy)
15:40:09.695 | Arguments:
15:40:09.695 | Directory: /vercel/path1/node_modules/sharp
15:40:09.695 | Output:
15:40:09.695 | sharp: Using cached /vercel/.npm/_libvips/libvips-8.11.3-linux-x64.tar.br
15:40:09.695 | /bin/sh: prebuild-install: command not found
15:40:09.695 | gyp info it worked if it ends with ok
15:40:09.695 | gyp info using [email protected]
15:40:09.695 | gyp info using [email protected] \| linux \| x64
15:40:09.695 | gyp info find Python using Python version 2.7.18 found at \"/usr/bin/python\"
15:40:09.695 | gyp http GET https://nodejs.org/download/release/v14.17.6/node-v14.17.6-headers.tar.gz
15:40:09.696 | gyp http 200 https://nodejs.org/download/release/v14.17.6/node-v14.17.6-headers.tar.gz
15:40:09.696 | gyp http GET https://nodejs.org/download/release/v14.17.6/SHASUMS256.txt
15:40:09.696 | gyp http 200 https://nodejs.org/download/release/v14.17.6/SHASUMS256.txt
15:40:09.696 | gyp info spawn /usr/bin/python
15:40:09.696 | gyp info spawn args [
15:40:09.696 | gyp info spawn args   '/node14/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
15:40:09.696 | gyp info spawn args   'binding.gyp',
15:40:09.696 | gyp info spawn args   '-f',
15:40:09.696 | gyp info spawn args   'make',
15:40:09.696 | gyp info spawn args   '-I',
15:40:09.696 | gyp info spawn args   '/vercel/path1/node_modules_dev/sharp/build/config.gypi',
15:40:09.696 | gyp info spawn args   '-I',
15:40:09.696 | gyp info spawn args   '/node14/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
15:40:09.697 | gyp info spawn args   '-I',
15:40:09.697 | gyp info spawn args   '/vercel/.cache/node-gyp/14.17.6/include/node/common.gypi',
15:40:09.697 | gyp info spawn args   '-Dlibrary=shared_library',
15:40:09.697 | gyp info spawn args   '-Dvisibility=default',
15:40:09.697 | gyp info spawn args   '-Dnode_root_dir=/vercel/.cache/node-gyp/14.17.6',
15:40:09.697 | gyp info spawn args   '-Dnode_gyp_dir=/node14/lib/node_modules/npm/node_modules/node-gyp',
15:40:09.697 | gyp info spawn args   '-Dnode_lib_file=/vercel/.cache/node-gyp/14.17.6/<(target_arch)/node.lib',
15:40:09.697 | gyp info spawn args   '-Dmodule_root_dir=/vercel/path1/node_modules_dev/sharp',
15:40:09.699 | gyp info spawn args   '-Dnode_engine=v8',
15:40:09.699 | gyp info spawn args   '--depth=.',
15:40:09.699 | gyp info spawn args   '--no-parallel',
15:40:09.699 | gyp info spawn args   '--generator-output',
15:40:09.699 | gyp info spawn args   'build',
15:40:09.699 | gyp info spawn args   '-Goutput_dir=.'
15:40:09.700 | gyp info spawn args ]
15:40:09.700 | gyp info spawn make
15:40:09.700 | gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
15:40:09.700 | make: Entering directory `/vercel/path1/node_modules_dev/sharp/build'
15:40:09.700 | CC(target) Release/obj.target/nothing/../node-addon-api/nothing.o
15:40:09.700 | AR(target) Release/obj.target/../node-addon-api/nothing.a
15:40:09.700 | COPY Release/nothing.a
15:40:09.700 | TOUCH Release/obj.target/libvips-cpp.stamp
15:40:09.700 | CXX(target) Release/obj.target/sharp-linux-x64/src/common.o
15:40:09.700 | ../src/common.cc:24:10: fatal error: vips/vips8: No such file or directory
15:40:09.700 | #include <vips/vips8>
15:40:09.700 | ^~~~~~~~~~~~
15:40:09.701 | compilation terminated.
15:40:09.701 | make: *** [Release/obj.target/sharp-linux-x64/src/common.o] Error 1
15:40:09.701 | make: Leaving directory `/vercel/path1/node_modules_dev/sharp/build'
15:40:09.701 | gyp ERR! build error
15:40:09.701 | gyp ERR! stack Error: `make` failed with exit code: 2
15:40:09.701 | gyp ERR! stack     at ChildProcess.onExit (/node14/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
15:40:09.701 | gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
15:40:09.701 | gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
15:40:09.701 | gyp ERR! System Linux 4.14.243-185.433.amzn2.x86_64
15:40:09.701 | gyp ERR! command \"/node14/bin/node\" \"/node14/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js\" \"rebuild\"
15:40:09.701 | gyp ERR! cwd /vercel/path1/node_modules_dev/sharp
15:40:09.702 | gyp ERR! node -v v14.17.6
15:40:09.702 | gyp ERR! node-gyp -v v5.1.0
15:40:09.702 | gyp ERR! not ok"
15:40:09.702 | info This module is OPTIONAL, you can safely ignore this error
15:40:09.947 | [5/5] Cleaning modules...
15:40:13.832 | Done in 15.67s.
15:40:13.860 | [info] Install devDependencies took: 17789.283915 ms
15:40:13.860 | [log]  ----------------- Nuxt build -----------------
15:40:14.136 | [log] Running nuxt build --standalone --no-lock --config-file "nuxt.config.js" /vercel/path1
15:40:14.881 | [error] [@nuxt/image] `ipx` is an optional dependency for local image optimization and is not properly installed. Please try `npm install` or `yarn install` again.
15:40:14.883 | [fatal] Error: Cannot find module 'sharp'
15:40:14.883 | Require stack:
15:40:14.883 | - /vercel/path1/node_modules_dev/ipx/dist/index.cjs
15:40:14.883 | - /vercel/path1/node_modules_dev/@nuxt/image/dist/module.js
15:40:14.883 | - /vercel/path1/node_modules_dev/@nuxt/core/dist/core.js
15:40:14.883 | Require stack:
15:40:14.884 | - node_modules_dev/ipx/dist/index.cjs
15:40:14.884 | - node_modules_dev/@nuxt/image/dist/module.js
15:40:14.884 | - node_modules_dev/@nuxt/core/dist/core.js
15:40:14.884 | at node_modules_dev/@nuxt/image/dist/module.js:132:13
15:40:14.884 | at async Object.ipxSetup [as setup] (node_modules_dev/@nuxt/image/dist/module.js:130:48)
15:40:14.884 | at async ModuleContainer.imageModule2 (node_modules_dev/@nuxt/image/dist/module.js:271:7)
15:40:14.884 | at async ModuleContainer.addModule (node_modules_dev/@nuxt/core/dist/core.js:239:20)
15:40:14.884 | at async ModuleContainer.ready (node_modules_dev/@nuxt/core/dist/core.js:55:5)
15:40:14.884 | at async Nuxt._init (node_modules_dev/@nuxt/core/dist/core.js:478:5)
15:40:14.892 | ╭─────────────────────────────────────────────────────────────────╮
15:40:14.892 | │                                                                 │
15:40:14.892 | │   ✖ Nuxt Fatal Error                                            │
15:40:14.892 | │                                                                 │
15:40:14.892 | │   Error: Error: Cannot find module 'sharp'                      │
15:40:14.892 | │   Require stack:                                                │
15:40:14.892 | │   - /vercel/path1/node_modules_dev/ipx/dist/index.cjs           │
15:40:14.892 | │   - /vercel/path1/node_modules_dev/@nuxt/image/dist/module.js   │
15:40:14.893 | │   - /vercel/path1/node_modules_dev/@nuxt/core/dist/core.js      │
15:40:14.893 | │                                                                 │
15:40:14.893 | ╰─────────────────────────────────────────────────────────────────╯
15:40:14.904 | Error: Command failed with exit code 1: npx nuxt build --standalone --no-lock --config-file "nuxt.config.js" /vercel/path1
15:40:14.904 | at makeError (/vercel/bde74988fa2cf27a/.build-utils/.builder/node_modules/execa/lib/error.js:60:11)
15:40:14.904 | at handlePromise (/vercel/bde74988fa2cf27a/.build-utils/.builder/node_modules/execa/index.js:118:26)
15:40:14.904 | at processTicksAndRejections (internal/process/task_queues.js:95:5)
15:40:14.905 | at Object.build (/vercel/bde74988fa2cf27a/.build-utils/.builder/node_modules/@nuxtjs/vercel-builder/lib/index.js:347:3)
15:40:14.905 | at buildStep (/var/task/webpack:/@vercel/api/scripts/build-container/src/utils/purpose-build.ts:161:1) {
15:40:14.905 | shortMessage: 'Command failed with exit code 1: npx nuxt build --standalone --no-lock --config-file "nuxt.config.js" /vercel/path1',
15:40:14.905 | command: 'npx nuxt build --standalone --no-lock --config-file "nuxt.config.js" /vercel/path1',
15:40:14.905 | escapedCommand: 'npx nuxt build --standalone --no-lock "--config-file \\"nuxt.config.js\\"" "/vercel/path1"',
15:40:14.905 | exitCode: 1,
15:40:14.905 | signal: undefined,
15:40:14.905 | signalDescription: undefined,
15:40:14.905 | stdout: undefined,
15:40:14.906 | stderr: undefined,
15:40:14.906 | failed: true,
15:40:14.906 | timedOut: false,
15:40:14.906 | isCanceled: false,
15:40:14.906 | killed: false
15:40:14.906 | }
15:40:19.889 | Build completed. Populating build cache...
15:40:35.567 | Uploading build cache [31.16 MB]...
15:40:36.389 | Build cache uploaded: 821.685ms
15:40:36.914 | Done with "api/subscribe.js"

riccardolardi avatar Oct 06 '21 13:10 riccardolardi

For what it's worth, I had to do 3 things to get nuxt/image working on Azure:

  1. Whenever you do the npm install part of your deployment, use benv node=14 npm install instead. This forces Azure's Kudu service to use node 14, instead of 10, to install sharp (which has a prerequisite of Node.js >= 12.13.0).
  2. Rather than relying on sharp to be installed via the package.json dependency, do a separate install as part of your deployment, like so: SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm_config_arch=x64 npm_config_platform=linux yarn add sharp
  3. My /server/middleware/ipx.js:
// This grabs the image config from nuxt.config and hands it to the middleware
import { createIPX, createIPXMiddleware } from 'ipx';
import config from '../../nuxt.config.js';
export default createIPXMiddleware(createIPX(config.image));

Referenced in my nuxt.config.js:

serverMiddleware: [
    { path: '/_ipx', handler: '~/server/middleware/ipx.js' },
],

These three steps were crucial for me to get nuxt/image working in production on Azure App Service.

nathanchase avatar Oct 10 '21 03:10 nathanchase

Thanks @nathanchase I got it to build by overriding Vercel's install command to SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm_config_arch=x64 npm_config_platform=linux yarn add sharp && yarn install only now the images on the live site all get 404 when displayed...

riccardolardi avatar Oct 11 '21 07:10 riccardolardi

Thanks @nathanchase I got it to build by overriding Vercel's install command to SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm_config_arch=x64 npm_config_platform=linux yarn add sharp && yarn install only now the images on the live site all get 404 when displayed...

I believe this is due to the single slash problem talked about at https://github.com/nuxt/image/issues/392. There's a reproduction of this error at https://nuxt-image-2gl6xp7kua-ue.a.run.app/

nathanchase avatar Oct 12 '21 04:10 nathanchase

I got it to build consistently by the help of https://github.com/nuxt/vercel-builder/issues/588 but I'm still facing the 404 issue on all images. Thanks to https://github.com/nuxt/image/issues/434#issuecomment-940650029 the slash issue is temporarily fixed too. Still, on production I get 404 on the images, not locally though. Could it have to do with them being hosted on another server? I've whitelisted it as described in https://image.nuxtjs.org/api/options

  image: {
    provider: 'ipx',
    domains: ['https://cms.blah.com'],
    alias: {
      cms: 'https://cms.blah.com',
    },
  },
<nuxt-picture :src="originalSrc.replace('https://cms.blah.com', 'cms')" />

riccardolardi avatar Oct 13 '21 10:10 riccardolardi

I got it to build consistently by the help of nuxt/vercel-builder#588 but I'm still facing the 404 issue on all images. Thanks to #434 (comment) the slash issue is temporarily fixed too. Still, on production I get 404 on the images, not locally though. Could it have to do with them being hosted on another server? I've whitelisted it as described in https://image.nuxtjs.org/api/options

  image: {
    provider: 'ipx',
    domains: ['https://cms.blah.com'],
    alias: {
      cms: 'https://cms.blah.com',
    },
  },
<nuxt-picture :src="originalSrc.replace('https://cms.blah.com', 'cms')" />

Yeah, it's not that your path to the file is incorrect in your template - it's that ipx is rewriting the path (on the server) without the second / and thus causing a 404. It's being generated dynamically correctly, but not pointed to correctly.

nathanchase avatar Oct 13 '21 15:10 nathanchase

@nathanchase Thanks - but I'm a bit confused - shouldn't using the alias option (as described in your previous comment) fix the single slash problem?

riccardolardi avatar Oct 14 '21 10:10 riccardolardi

@nathanchase Thanks - but I'm a bit confused - shouldn't using the alias option (as described in your previous comment) fix the single slash problem?

It did for me, but I'm also not using components, but rather just $img in a custom component.

nathanchase avatar Oct 14 '21 11:10 nathanchase

Hi folks, I'm facing this exactly problem too. Apparently it's something related with version "@nuxt/image": "0.6.1", This is working well with version "@nuxt/image": "0.4.17"

Hope it helps!

irving-caamal avatar Feb 02 '22 01:02 irving-caamal

This is working well with version "@nuxt/image": "0.4.17"

I had the same issue with Netlify, and this worked like a charm. But on my local machine, this version of nuxt-image (0.4.17) prevents any run with the error :

GLib-WARNING Failed determine console output code page

So I tried to upgrade to 0.6.0 ( based on the issue #488 ) and it' now working fine locally and on Netlify :)

rsellin avatar Mar 09 '22 14:03 rsellin

oh yes i did forgot to change my node version to 14 instead of 12. Thanks my bad.

jovyllebermudez avatar Apr 25 '22 17:04 jovyllebermudez