Home
Support Forums

Error when deploying a remix app on netlify

I have created a new remix app, chosen netlify as deploy target, added tailwind and have connected the site to git repo

Having the same issue since first build

Site ID : practical-ptolemy-c2b133

It doesn’t have a deploy url yet because the problem is with the deployment

GitHub URL GitHub - Rohithgilla12/dev-to-wrapped

Deploy log

10:45:21 PM: Build ready to start
10:45:23 PM: build-image version: 73def8bb10593b9b818f44989a75ea508018ccb7 (focal)
10:45:23 PM: build-image tag: v4.5.2
10:45:23 PM: buildbot version: e07f38cea73012d29c839c78dec87335277fe704
10:45:24 PM: Fetching cached dependencies
10:45:24 PM: Failed to fetch cache, continuing with build
10:45:24 PM: Starting to prepare the repo for build
10:45:24 PM: No cached dependencies found. Cloning fresh repo
10:45:24 PM: git clone GitHub - Rohithgilla12/dev-to-wrapped
10:45:25 PM: Preparing Git Reference refs/heads/main
10:45:25 PM: Parsing package.json dependencies
10:45:27 PM: Starting build script
10:45:27 PM: Installing dependencies
10:45:27 PM: Python version set to 2.7
10:45:27 PM: v16.13.1 is already installed.
10:45:28 PM: Now using node v16.13.1 (npm v8.1.2)
10:45:28 PM: Started restoring cached build plugins
10:45:28 PM: Finished restoring cached build plugins
10:45:28 PM: Attempting ruby version 2.7.2, read from environment
10:45:30 PM: Using ruby version 2.7.2
10:45:30 PM: Using PHP version 8.0
10:45:30 PM: Started restoring cached yarn cache
10:45:30 PM: Finished restoring cached yarn cache
10:45:31 PM: No yarn workspaces detected
10:45:31 PM: Started restoring cached node modules
10:45:31 PM: Finished restoring cached node modules
10:45:32 PM: Installing NPM modules using Yarn version 1.22.10
10:45:32 PM: yarn install v1.22.10
10:45:33 PM: [1/5] Validating package.json…
10:45:33 PM: [2/5] Resolving packages…
10:45:33 PM: [3/5] Fetching packages…
10:45:54 PM: info fsevents@2.3.2: The platform β€œlinux” is incompatible with this module.
10:45:54 PM: info β€œfsevents@2.3.2” is an optional dependency and failed compatibility check. Excluding it from installation.
10:45:54 PM: info esbuild-android-arm64@0.13.14: The platform β€œlinux” is incompatible with this module.
10:45:54 PM: info β€œesbuild-android-arm64@0.13.14” is an optional dependency and failed compatibility check. Excluding it from installation.
10:45:54 PM: info esbuild-android-arm64@0.13.14: The CPU architecture β€œx64” is incompatible with this module.
10:45:54 PM: info esbuild-darwin-64@0.13.14: The platform β€œlinux” is incompatible with this module.
10:45:54 PM: info β€œesbuild-darwin-64@0.13.14” is an optional dependency and failed compatibility check. Excluding it from installation.
10:45:54 PM: info esbuild-darwin-arm64@0.13.14: The platform β€œlinux” is incompatible with this module.
10:45:54 PM: info β€œesbuild-darwin-arm64@0.13.14” is an optional dependency and failed compatibility check. Excluding it from installation.
10:45:54 PM: info esbuild-darwin-arm64@0.13.14: The CPU architecture β€œx64” is incompatible with this module.
10:45:54 PM: info esbuild-freebsd-64@0.13.14: The platform β€œlinux” is incompatible with this module.
10:45:54 PM: info β€œesbuild-freebsd-64@0.13.14” is an optional dependency and failed compatibility check. Excluding it from installation.
10:45:54 PM: info esbuild-freebsd-arm64@0.13.14: The platform β€œlinux” is incompatible with this module.
10:45:54 PM: info β€œesbuild-freebsd-arm64@0.13.14” is an optional dependency and failed compatibility check. Excluding it from installation.
10:45:54 PM: info esbuild-freebsd-arm64@0.13.14: The CPU architecture β€œx64” is incompatible with this module.
10:45:54 PM: info esbuild-linux-32@0.13.14: The CPU architecture β€œx64” is incompatible with this module.
10:45:54 PM: info β€œesbuild-linux-32@0.13.14” is an optional dependency and failed compatibility check. Excluding it from installation.
10:45:54 PM: info esbuild-linux-arm@0.13.14: The CPU architecture β€œx64” is incompatible with this module.
10:45:54 PM: info β€œesbuild-linux-arm@0.13.14” is an optional dependency and failed compatibility check. Excluding it from installation.
10:45:54 PM: info esbuild-linux-arm64@0.13.14: The CPU architecture β€œx64” is incompatible with this module.
10:45:54 PM: info β€œesbuild-linux-arm64@0.13.14” is an optional dependency and failed compatibility check. Excluding it from installation.
10:45:54 PM: info esbuild-linux-mips64le@0.13.14: The CPU architecture β€œx64” is incompatible with this module.
10:45:54 PM: info β€œesbuild-linux-mips64le@0.13.14” is an optional dependency and failed compatibility check. Excluding it from installation.
10:45:54 PM: info esbuild-linux-ppc64le@0.13.14: The CPU architecture β€œx64” is incompatible with this module.
10:45:54 PM: info β€œesbuild-linux-ppc64le@0.13.14” is an optional dependency and failed compatibility check. Excluding it from installation.
10:45:54 PM: info esbuild-netbsd-64@0.13.14: The platform β€œlinux” is incompatible with this module.
10:45:54 PM: info β€œesbuild-netbsd-64@0.13.14” is an optional dependency and failed compatibility check. Excluding it from installation.
10:45:54 PM: info esbuild-openbsd-64@0.13.14: The platform β€œlinux” is incompatible with this module.
10:45:54 PM: info β€œesbuild-openbsd-64@0.13.14” is an optional dependency and failed compatibility check. Excluding it from installation.
10:45:54 PM: info esbuild-sunos-64@0.13.14: The platform β€œlinux” is incompatible with this module.
10:45:54 PM: info β€œesbuild-sunos-64@0.13.14” is an optional dependency and failed compatibility check. Excluding it from installation.
10:45:54 PM: info esbuild-windows-32@0.13.14: The platform β€œlinux” is incompatible with this module.
10:45:54 PM: info β€œesbuild-windows-32@0.13.14” is an optional dependency and failed compatibility check. Excluding it from installation.
10:45:54 PM: info esbuild-windows-32@0.13.14: The CPU architecture β€œx64” is incompatible with this module.
10:45:54 PM: info esbuild-windows-64@0.13.14: The platform β€œlinux” is incompatible with this module.
10:45:54 PM: info β€œesbuild-windows-64@0.13.14” is an optional dependency and failed compatibility check. Excluding it from installation.
10:45:54 PM: info esbuild-windows-arm64@0.13.14: The platform β€œlinux” is incompatible with this module.
10:45:54 PM: info β€œesbuild-windows-arm64@0.13.14” is an optional dependency and failed compatibility check. Excluding it from installation.
10:45:54 PM: info esbuild-windows-arm64@0.13.14: The CPU architecture β€œx64” is incompatible with this module.
10:45:54 PM: [4/5] Linking dependencies…
10:45:54 PM: warning " > rough-charts@0.5.0" has incorrect peer dependency β€œreact@^16.10.2”.
10:45:54 PM: warning " > rough-charts@0.5.0" has incorrect peer dependency β€œreact-dom@^16.10.2”.
10:45:54 PM: warning β€œrough-charts > react-roughjs@0.1.3-alpha.0” has incorrect peer dependency β€œreact@^16.10.1”.
10:45:54 PM: warning β€œrough-charts > react-roughjs@0.1.3-alpha.0” has incorrect peer dependency β€œreact-dom@^16.10.1”.
10:45:54 PM: warning β€œrough-charts > react-docgen-typescript-loader > @webpack-contrib/schema-utils@1.0.0-beta.0” has unmet peer dependency β€œwebpack@^3.0.0 || ^4.0.0”.
10:45:54 PM: warning " > tailwindcss@3.0.7" has unmet peer dependency β€œautoprefixer@^10.0.2”.
10:45:54 PM: warning " > tailwindcss@3.0.7" has unmet peer dependency β€œpostcss@^8.0.9”.
10:45:54 PM: warning β€œtailwindcss > postcss-nested@5.0.6” has unmet peer dependency β€œpostcss@^8.2.14”.
10:46:01 PM: [5/5] Building fresh packages…
10:46:02 PM: $ remix setup node
10:46:02 PM: Successfully setup Remix for node.
10:46:03 PM: Done in 30.10s.
10:46:03 PM: NPM modules installed using Yarn
10:46:03 PM: Started restoring cached go cache
10:46:03 PM: Finished restoring cached go cache
10:46:03 PM: go version go1.16.5 linux/amd64
10:46:03 PM: go version go1.16.5 linux/amd64
10:46:03 PM: Installing missing commands
10:46:03 PM: Verify run directory
10:46:05 PM: ​
10:46:05 PM: ────────────────────────────────────────────────────────────────
10:46:05 PM: Netlify Build
10:46:05 PM: ────────────────────────────────────────────────────────────────
10:46:05 PM: ​
10:46:05 PM: ❯ Version
10:46:05 PM: @netlify/build 26.0.2
10:46:05 PM: ​
10:46:05 PM: ❯ Flags
10:46:05 PM: baseRelDir: true
10:46:05 PM: buildId: 61c8a3286af1e00007a0ea2a
10:46:05 PM: deployId: 61c8a3296af1e00007a0ea2c
10:46:05 PM: ​
10:46:05 PM: ❯ Current directory
10:46:05 PM: /opt/build/repo
10:46:05 PM: ​
10:46:05 PM: ❯ Config file
10:46:05 PM: /opt/build/repo/netlify.toml
10:46:05 PM: ​
10:46:05 PM: ❯ Context
10:46:05 PM: production
10:46:05 PM: ​
10:46:05 PM: ────────────────────────────────────────────────────────────────
10:46:05 PM: 1. build.command from netlify.toml
10:46:05 PM: ────────────────────────────────────────────────────────────────
10:46:05 PM: ​
10:46:05 PM: $ remix build
10:46:06 PM: Building Remix app in production mode…
10:46:07 PM: Built in 869ms
10:46:07 PM: ​
10:46:07 PM: (build.command completed in 1.3s)
10:46:07 PM: ​
10:46:07 PM: ────────────────────────────────────────────────────────────────
10:46:07 PM: 2. Functions bundling
10:46:07 PM: ────────────────────────────────────────────────────────────────
10:46:07 PM: ​
10:46:07 PM: Packaging Functions from netlify/functions directory:
10:46:07 PM: - server/index.js
10:46:07 PM: ​
10:46:08 PM: ​
10:46:08 PM: ────────────────────────────────────────────────────────────────
10:46:08 PM: Dependencies installation error
10:46:08 PM: ────────────────────────────────────────────────────────────────
10:46:08 PM: ​
10:46:08 PM: Error message
10:46:08 PM: A Netlify Function failed to require one of its dependencies.
10:46:08 PM: Please make sure it is present in the site’s top-level β€œpackage.json”.​
10:46:08 PM: In file β€œ/opt/build/repo/netlify/functions/server/index.js”
10:46:08 PM: Cannot find module β€˜webpack’
10:46:08 PM: Require stack:
10:46:08 PM: - /opt/buildhome/node-deps/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/node/bundlers/zisi/resolve.js
10:46:08 PM: - /opt/buildhome/node-deps/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/node/bundlers/zisi/traverse.js
10:46:08 PM: - /opt/buildhome/node-deps/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/node/bundlers/esbuild/src_files.js
10:46:08 PM: - /opt/buildhome/node-deps/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/node/bundlers/esbuild/index.js
10:46:08 PM: - /opt/buildhome/node-deps/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/node/bundlers/index.js
10:46:08 PM: - /opt/buildhome/node-deps/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/node/index.js
10:46:08 PM: - /opt/buildhome/node-deps/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/index.js
10:46:08 PM: - /opt/buildhome/node-deps/node_modules/@netlify/zip-it-and-ship-it/dist/main.js
10:46:08 PM: ​
10:46:08 PM: Resolved config
10:46:08 PM: build:
10:46:08 PM: command: remix build
10:46:08 PM: commandOrigin: config
10:46:08 PM: environment:
10:46:08 PM: - AWS_LAMBDA_JS_RUNTIME
10:46:08 PM: publish: /opt/build/repo/public
10:46:08 PM: publishOrigin: config
10:46:08 PM: functionsDirectory: /opt/build/repo/netlify/functions
10:46:08 PM: headers:
10:46:09 PM: - for: /build/* values: Cache-Control: public, max-age=31536000, s-maxage=31536000 headersOrigin: config redirects: - from: /* status: 200 to: /.netlify/functions/server redirectsOrigin: configCaching artifacts
10:46:09 PM: Started saving node modules
10:46:09 PM: Finished saving node modules
10:46:09 PM: Started saving build plugins
10:46:09 PM: Finished saving build plugins
10:46:09 PM: Started saving yarn cache
10:46:13 PM: Finished saving yarn cache
10:46:13 PM: Started saving pip cache
10:46:13 PM: Finished saving pip cache
10:46:13 PM: Started saving emacs cask dependencies
10:46:13 PM: Finished saving emacs cask dependencies
10:46:13 PM: Started saving maven dependencies
10:46:13 PM: Finished saving maven dependencies
10:46:13 PM: Started saving boot dependencies
10:46:13 PM: Finished saving boot dependencies
10:46:13 PM: Started saving rust rustup cache
10:46:13 PM: Finished saving rust rustup cache
10:46:13 PM: Started saving go dependencies
10:46:13 PM: Finished saving go dependencies
10:46:16 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
10:46:16 PM: Creating deploy upload records
10:46:16 PM: Failing build: Failed to build site
10:46:16 PM: Failed during stage β€˜building site’: Build script returned non-zero exit code: 2
10:46:16 PM: Finished processing build request in 52.861479086s

Hi @Rohithgilla12

Welcome to the forums :netliconfetti:

I downloaded the repository you shared and received the same error locally when trying to build.

I added webpack to the project (yarn add webpack) and the build succeeded. Can you try adding webpack and redeploy to see if that fixes the issue.

2 Likes

Thanks a lot.
It works like a magic now.

Maybe add these in the remix docs, like in the readme it generates or the template it creates.

Just a suggestion, but cool thanks for the support.

Great that it works now @Rohithgilla12 :partying_face:

As I was able to replicate the issue locally it is not a Netlify-specific issue, rather an issue with Remix, the @remix-run/netlify plugin (maintained by Remix, not Netlify), or something with the setup of your project.

If you are sure the webpack dependency shouldn’t need added explicitly, you may wish to add an issue on the Remix GitHub repository as they are the ones responsible for maintaining the documentation also.

I retract my previous comments as it appears the issue is with @netlify/build or @netlify/zip-it-and-ship-it.

That said, I was able to get around the issue without having to add webpack as a dependency by adding

[functions]
  node_bundler = "esbuild"

to the netlify.toml in the root of the project. This method does throw a few warning and suggested adding

[functions]
  external_node_modules = ["@remix-run/react"]

to the neltify.toml so that it looks like

[functions]
  node_bundler = "esbuild"
  external_node_modules = ["@remix-run/react"]