Nuxt 3 deploy fails

Hello, I am trying to deploy a Nuxt 3 site for the first time and getting an error.
This is the site in Netlify: warm-choux-406b9e

Here is the full deploy log:

10:04:40 PM: Build ready to start 10:04:42 PM: build-image version: d7b3dbfb0846505993c9a131894d1858074c90b4 (focal) 10:04:42 PM: build-image tag: v4.10.1 10:04:42 PM: buildbot version: 37262c48b1f3cfa88c6caed707d29b19aef6a5a7 10:04:42 PM: Building without cache 10:04:42 PM: Starting to prepare the repo for build 10:04:42 PM: No cached dependencies found. Cloning fresh repo 10:04:42 PM: git clone https://github.com/rabbitdan/troyelliottmusic 10:04:43 PM: Preparing Git Reference refs/heads/main 10:04:44 PM: Parsing package.json dependencies 10:04:45 PM: Starting build script 10:04:45 PM: Installing dependencies 10:04:45 PM: Python version set to 2.7 10:04:45 PM: Downloading and installing node v16.17.0... 10:04:45 PM: Downloading https://nodejs.org/dist/v16.17.0/node-v16.17.0-linux-x64.tar.xz... 10:04:46 PM: Computing checksum with sha256sum 10:04:46 PM: Checksums matched! 10:04:48 PM: Now using node v16.17.0 (npm v8.15.0) 10:04:48 PM: Started restoring cached build plugins 10:04:48 PM: Finished restoring cached build plugins 10:04:49 PM: Attempting ruby version 2.7.2, read from environment 10:04:49 PM: Using ruby version 2.7.2 10:04:49 PM: Using PHP version 8.0 10:04:50 PM: No npm workspaces detected 10:04:50 PM: Started restoring cached node modules 10:04:50 PM: Finished restoring cached node modules 10:04:50 PM: Installing NPM modules using NPM version 8.15.0 10:04:50 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special 10:04:50 PM: npm WARN config location in the cache, and they are managed by 10:04:50 PM: npm WARN config [cacache](http://npm.im/cacache). 10:04:50 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special 10:04:50 PM: npm WARN config location in the cache, and they are managed by 10:04:50 PM: npm WARN config [cacache](http://npm.im/cacache). 10:05:08 PM: npm WARN EBADENGINE Unsupported engine { 10:05:08 PM: npm WARN EBADENGINE package: 'hawk@0.10.2', 10:05:08 PM: npm WARN EBADENGINE required: { node: '0.8.x' }, 10:05:08 PM: npm WARN EBADENGINE current: { node: 'v16.17.0', npm: '8.15.0' } 10:05:08 PM: npm WARN EBADENGINE } 10:05:08 PM: npm WARN EBADENGINE Unsupported engine { 10:05:08 PM: npm WARN EBADENGINE package: 'hoek@0.7.6', 10:05:08 PM: npm WARN EBADENGINE required: { node: '0.8.x' }, 10:05:08 PM: npm WARN EBADENGINE current: { node: 'v16.17.0', npm: '8.15.0' } 10:05:08 PM: npm WARN EBADENGINE } 10:05:10 PM: npm WARN deprecated boom@0.3.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial). 10:05:10 PM: npm WARN deprecated cryptiles@0.1.0: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial). 10:05:10 PM: npm WARN deprecated sntp@0.1.2: This module moved to @hapi/sntp. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues. 10:05:11 PM: npm WARN deprecated hoek@0.7.6: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial). 10:05:11 PM: npm WARN deprecated node-uuid@1.4.8: Use uuid module instead 10:05:11 PM: npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility 10:05:11 PM: npm WARN deprecated hawk@0.10.2: This module moved to @hapi/hawk. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues. 10:05:11 PM: npm WARN deprecated json3@3.2.6: Please use the native JSON object instead of JSON 3 10:05:12 PM: npm WARN deprecated request@2.16.6: request has been deprecated, see https://github.com/request/request/issues/3142 10:05:13 PM: npm WARN deprecated hoek@0.4.2: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial). 10:05:13 PM: npm WARN deprecated hoek@0.4.2: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial). 10:05:16 PM: added 814 packages, and audited 815 packages in 26s 10:05:16 PM: 95 packages are looking for funding 10:05:16 PM: run npm fundfor details 10:05:16 PM: 19 vulnerabilities (1 low, 7 moderate, 9 high, 2 critical) 10:05:16 PM: To address issues that do not require attention, run: 10:05:16 PM: npm audit fix 10:05:16 PM: Some issues need review, and may require choosing 10:05:16 PM: a different dependency. 10:05:16 PM: Runnpm audit for details. 10:05:16 PM: NPM modules installed 10:05:16 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special 10:05:16 PM: npm WARN config location in the cache, and they are managed by 10:05:16 PM: npm WARN config [cacache](http://npm.im/cacache). 10:05:16 PM: Started restoring cached go cache 10:05:16 PM: Finished restoring cached go cache 10:05:16 PM: Installing Go version 1.17 (requested 1.17) 10:05:21 PM: unset GOOS; 10:05:21 PM: unset GOARCH; 10:05:21 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.17.linux.amd64'; 10:05:21 PM: export PATH="/opt/buildhome/.gimme/versions/go1.17.linux.amd64/bin:${PATH}"; 10:05:21 PM: go version >&2; 10:05:21 PM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.17.linux.amd64.env" 10:05:21 PM: go version go1.17 linux/amd64 10:05:21 PM: Installing missing commands 10:05:21 PM: Verify run directory 10:05:23 PM: ​ 10:05:23 PM: ──────────────────────────────────────────────────────────────── 10:05:23 PM: Netlify Build 10:05:23 PM: ──────────────────────────────────────────────────────────────── 10:05:23 PM: ​ 10:05:23 PM: ❯ Version 10:05:23 PM: @netlify/build 27.17.1 10:05:23 PM: ​ 10:05:23 PM: ❯ Flags 10:05:23 PM: baseRelDir: true 10:05:23 PM: buildId: 632241e8d42d165cdd67f35e 10:05:23 PM: deployId: 632241e8d42d165cdd67f360 10:05:23 PM: ​ 10:05:23 PM: ❯ Current directory 10:05:23 PM: /opt/build/repo 10:05:23 PM: ​ 10:05:23 PM: ❯ Config file 10:05:23 PM: No config file was defined: using default values. 10:05:23 PM: ​ 10:05:23 PM: ❯ Context 10:05:23 PM: production 10:05:23 PM: ​ 10:05:23 PM: ──────────────────────────────────────────────────────────────── 10:05:23 PM: 1. Build command from Netlify app 10:05:23 PM: ──────────────────────────────────────────────────────────────── 10:05:23 PM: ​ 10:05:23 PM: $ npm run build 10:05:23 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special 10:05:23 PM: npm WARN config location in the cache, and they are managed by 10:05:23 PM: npm WARN config [cacache](http://npm.im/cacache). 10:05:23 PM: > build 10:05:23 PM: > nuxi build 10:05:23 PM: [log] Nuxi 3.0.0-rc.11-27719556.94377b1 10:05:23 PM: [log] Nuxt with Nitro 0.5.3-27719444.ff99330 10:05:23 PM: [error] Cannot find module 'nuxt' 10:05:23 PM: Require stack: 10:05:23 PM: - /opt/build/repo/index.js 10:05:23 PM: Require stack: 10:05:23 PM: - index.js 10:05:23 PM: at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15) 10:05:23 PM: at Function.resolve (node:internal/modules/cjs/helpers:108:19) 10:05:23 PM: at Function._resolve [as resolve] (node_modules/jiti/dist/jiti.js:1:243297) 10:05:23 PM: at resolveModule (node_modules/@nuxt/kit/dist/index.mjs:254:29) 10:05:23 PM: at importModule (node_modules/@nuxt/kit/dist/index.mjs:282:24) 10:05:23 PM: at loadNuxt (node_modules/@nuxt/kit/dist/index.mjs:724:43) 10:05:23 PM: at async Object.invoke (node_modules/nuxi/dist/chunks/build.mjs:34:18) 10:05:23 PM: at async _main (node_modules/nuxi/dist/cli.mjs:50:20) 10:05:23 PM: ​ 10:05:23 PM: ──────────────────────────────────────────────────────────────── 10:05:23 PM: "build.command" failed 10:05:23 PM: ──────────────────────────────────────────────────────────────── 10:05:23 PM: ​ 10:05:23 PM: Error message 10:05:23 PM: Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1) 10:05:23 PM: ​ 10:05:23 PM: Error location 10:05:23 PM: In Build command from Netlify app: 10:05:23 PM: npm run build 10:05:23 PM: ​ 10:05:23 PM: Resolved config 10:05:23 PM: build: 10:05:23 PM: command: npm run build 10:05:23 PM: commandOrigin: ui 10:05:23 PM: environment: 10:05:23 PM: - NITRO_PRESET 10:05:23 PM: publish: /opt/build/repo/dist 10:05:23 PM: publishOrigin: ui 10:05:24 PM: Caching artifacts 10:05:24 PM: Started saving node modules 10:05:24 PM: Finished saving node modules 10:05:24 PM: Started saving build plugins 10:05:24 PM: Finished saving build plugins 10:05:24 PM: Started saving pip cache 10:05:24 PM: Finished saving pip cache 10:05:24 PM: Started saving emacs cask dependencies 10:05:24 PM: Finished saving emacs cask dependencies 10:05:24 PM: Started saving maven dependencies 10:05:24 PM: Finished saving maven dependencies 10:05:24 PM: Started saving boot dependencies 10:05:24 PM: Finished saving boot dependencies 10:05:24 PM: Started saving rust rustup cache 10:05:24 PM: Finished saving rust rustup cache 10:05:24 PM: Started saving go dependencies 10:05:24 PM: Finished saving go dependencies 10:05:25 PM: Build failed due to a user error: Build script returned non-zero exit code: 2 10:05:25 PM: Creating deploy upload records 10:05:25 PM: Failing build: Failed to build site 10:05:25 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2) 10:05:25 PM: Finished processing build request in 43.267479104s

It builds fine locally. You’ll note I have added a NITRO preset as requested in the Nuxt 3 docs: https://v3.nuxtjs.org/guide/deploy/presets/ I’m drawing a blank now though. I haven’t seen the same error on here.

Does anyone have any ideas? Thanks in advance!

Also, i gather there’s a better way of posting logs. How do I do that?

1 Like

Also, this is the specific error part of the log:

10:05:23 PM:   Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
10:05:23 PM: ​
10:05:23 PM:   Error location
10:05:23 PM:   In Build command from Netlify app:
10:05:23 PM:   npm run build
10:05:23 PM: ​
10:05:23 PM:   Resolved config
10:05:23 PM:   build:
10:05:23 PM:     command: npm run build
10:05:23 PM:     commandOrigin: ui
10:05:23 PM:     environment:
10:05:23 PM:       - NITRO_PRESET
10:05:23 PM:     publish: /opt/build/repo/dist
10:05:23 PM:     publishOrigin: ui
10:05:24 PM: Caching artifacts```
1 Like

Hi @rabbitdan

The error is

10:05:23 PM: [error] Cannot find module 'nuxt'

This would suggest it wasn’t installed.

And you found the better way of posted logs :+1: by using three ``` at either end of the code/log lines :smiley:

1 Like

@coelmay Yeah i’ve been puzzling over that because it does run locally. Though your giving this response has made me think, for some reason the Nuxt set up protocol I used put this unconventional value in my package.json: "nuxt3": "latest" instead of nuxt. I might need to do a fresh set up of the site using a different method so that I get a proper nuxt value in my package.json. Thanks for the reply! I’ll update here if this works.

2 Likes

@coelmay That was the problem. I did a completely fresh install of nuxt 3 and put my component files etc on top of the new install and then deployed. It worked after a few other bits of shuffling. Thanks for the nudge in the right direction! I’m not sure how my package.json ever had nuxt3 in there instead of just nuxt!

2 Likes