When trying to deploy my Remix site everything builds but when Netlify tries to load the server.js file imports.
Build log:
5:36:24 PM: Build ready to start
5:36:28 PM: build-image version: d2c6dbeac570350a387d832f64bc980dc964ad65 (focal)
5:36:28 PM: build-image tag: v4.8.0
5:36:28 PM: buildbot version: 0475eccc4c4863180929fe6d58b546f8277ad384
5:36:29 PM: Fetching cached dependencies
5:36:29 PM: Starting to download cache of 588.4MB
5:36:35 PM: Finished downloading cache in 6.185240461s
5:36:35 PM: Starting to extract cache
5:36:49 PM: Finished extracting cache in 14.530385722s
5:36:49 PM: Finished fetching cache in 20.772338317s
5:36:49 PM: Starting to prepare the repo for build
5:36:49 PM: Preparing Git Reference refs/heads/master
5:36:50 PM: Parsing package.json dependencies
5:36:51 PM: Different functions path detected, going to use the one specified in the Netlify configuration file: 'netlify/functions' versus '.netlify/functions' in the Netlify UI
5:36:51 PM: Starting build script
5:36:51 PM: Installing dependencies
5:36:51 PM: Python version set to 2.7
5:36:51 PM: Started restoring cached node version
5:36:52 PM: Finished restoring cached node version
5:36:53 PM: v16.14.2 is already installed.
5:36:53 PM: Now using node v16.14.2 (npm v8.5.0)
5:36:53 PM: Started restoring cached build plugins
5:36:53 PM: Finished restoring cached build plugins
5:36:53 PM: Attempting ruby version 2.7.2, read from environment
5:36:54 PM: Using ruby version 2.7.2
5:36:55 PM: Using PHP version 8.0
5:36:55 PM: Started restoring cached yarn cache
5:37:03 PM: Finished restoring cached yarn cache
5:37:04 PM: Found yarn version (1.22.18) that doesn't match expected (1.22.10)
5:37:04 PM: up to date, audited 1 package in 216ms
5:37:04 PM: found 0 vulnerabilities
5:37:04 PM: Installing yarn at version 1.22.10
5:37:04 PM: Installing Yarn!
5:37:04 PM: > Downloading tarball...
5:37:04 PM: [1/2]: https://yarnpkg.com/downloads/1.22.10/yarn-v1.22.10.tar.gz --> /tmp/yarn.tar.gz.9o6GeczjrA
5:37:04 PM: % Total % Received % Xferd Average Speed Time Time Time Current
5:37:04 PM: Dload Upload Total Spent Left Speed
5:37:04 PM: 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
5:37:04 PM: 100 81 100 81 0 0 653 0 --:--:-- --:--:-- --:--:-- 653
5:37:04 PM: 100 95 100 95 0 0 439 0 --:--:-- --:--:-- --:--:-- 439
5:37:04 PM: 100 657 100 657 0 0 2460 0 --:--:-- --:--:-- --:--:-- 2460
5:37:05 PM: 100 1215k 100 1215k 0 0 2707k 0 --:--:-- --:--:-- --:--:-- 2707k
5:37:05 PM: [2/2]: https://yarnpkg.com/downloads/1.22.10/yarn-v1.22.10.tar.gz.asc --> /tmp/yarn.tar.gz.9o6GeczjrA.asc
5:37:05 PM: % Total % Received % Xferd Average Speed Time Time Time Current
5:37:05 PM: Dload Upload Total Spent Left Speed
5:37:05 PM: 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
5:37:05 PM: 100 85 100 85 0 0 3269 0 --:--:-- --:--:-- --:--:-- 3148
5:37:05 PM: 100 85 100 85 0 0 3269 0 --:--:-- --:--:-- --:--:-- 3148
5:37:05 PM: 100 99 100 99 0 0 2475 0 --:--:-- --:--:-- --:--:-- 2475
5:37:05 PM: 100 661 100 661 0 0 12471 0 --:--:-- --:--:-- --:--:-- 12471
5:37:05 PM: 100 832 100 832 0 0 9674 0 --:--:-- --:--:-- --:--:-- 9674
5:37:05 PM: > Verifying integrity...
5:37:05 PM: gpg: Signature made Fri 02 Oct 2020 11:17:27 AM UTC
5:37:05 PM: gpg: using RSA key 6D98490C6F1ACDDD448E45954F77679369475BAA
5:37:05 PM: gpg: Good signature from "Yarn Packaging <yarn@dan.cx>" [unknown]
5:37:05 PM: gpg: WARNING: This key is not certified with a trusted signature!
5:37:05 PM: gpg: There is no indication that the signature belongs to the owner.
5:37:05 PM: Primary key fingerprint: 72EC F46A 56B4 AD39 C907 BBB7 1646 B01B 86E5 0310
5:37:05 PM: Subkey fingerprint: 6D98 490C 6F1A CDDD 448E 4595 4F77 6793 6947 5BAA
5:37:05 PM: > GPG signature looks good
5:37:05 PM: > Extracting to ~/.yarn...
5:37:05 PM: > Adding to $PATH...
5:37:05 PM: > Successfully installed Yarn 1.22.10! Please open another terminal where the `yarn` command will now be available.
5:37:05 PM: No yarn workspaces detected
5:37:05 PM: Started restoring cached node modules
5:37:05 PM: Finished restoring cached node modules
5:37:06 PM: Installing NPM modules using Yarn version 1.22.18
5:37:06 PM: yarn install v1.22.18
5:37:06 PM: [1/5] Validating package.json...
5:37:06 PM: [2/5] Resolving packages...
5:37:07 PM: [3/5] Fetching packages...
5:37:07 PM: [4/5] Linking dependencies...
5:37:07 PM: warning " > @remix-run/netlify@1.3.4" has incorrect peer dependency "@netlify/functions@^0.10.0".
5:37:07 PM: warning "react-bricks > rb-cogo-toast@4.2.6" has unmet peer dependency "prop-types@^15.6.2".
5:37:07 PM: warning "react-bricks > rb-cogo-toast@4.2.6" has incorrect peer dependency "react@^16.8.0 || ^17.0.0".
5:37:07 PM: warning "react-bricks > rb-cogo-toast@4.2.6" has incorrect peer dependency "react-dom@^16.8.0 || ^17.0.0".
5:37:07 PM: warning "react-bricks > react-copy-to-clipboard@5.0.4" has incorrect peer dependency "react@^15.3.0 || ^16.0.0 || ^17.0.0".
5:37:07 PM: warning "react-bricks > react-modal@3.14.4" has incorrect peer dependency "react@^0.14.0 || ^15.0.0 || ^16 || ^17".
5:37:07 PM: warning "react-bricks > react-modal@3.14.4" has incorrect peer dependency "react-dom@^0.14.0 || ^15.0.0 || ^16 || ^17".
5:37:07 PM: warning "react-bricks > react-progressive-graceful-image@0.6.14" has incorrect peer dependency "react@^15.0.0-0 || ^16.0.0-0 || ^17.0.0-0".
5:37:07 PM: warning "react-bricks > react-progressive-graceful-image@0.6.14" has incorrect peer dependency "react-dom@^15.0.0-0 || ^16.0.0-0 || ^17.0.0-0".
5:37:07 PM: warning "react-bricks > react-query@3.34.19" has incorrect peer dependency "react@^16.8.0 || ^17.0.0".
5:37:07 PM: warning "react-bricks > react-tag-autocomplete@6.3.0" has unmet peer dependency "prop-types@^15.5.0".
5:37:07 PM: warning "react-bricks > react-tag-autocomplete@6.3.0" has incorrect peer dependency "react@^16.5.0 || ^17.0.0".
5:37:07 PM: warning "react-bricks > react-tag-autocomplete@6.3.0" has incorrect peer dependency "react-dom@^16.5.0 || ^17.0.0".
5:37:07 PM: warning "react-bricks > react-progressive-graceful-image > @researchgate/react-intersection-observer@1.3.5" has incorrect peer dependency "react@^16.3.2".
5:37:07 PM: warning "react-bricks > react-progressive-graceful-image > @researchgate/react-intersection-observer@1.3.5" has incorrect peer dependency "react-dom@^16.3.2".
5:37:07 PM: warning "react-bricks-ui > react-leaflet@3.2.5" has incorrect peer dependency "react@^17.0.1".
5:37:07 PM: warning "react-bricks-ui > react-leaflet@3.2.5" has incorrect peer dependency "react-dom@^17.0.1".
5:37:07 PM: warning "react-bricks-ui > react-simple-code-editor@0.11.0" has incorrect peer dependency "react@^16.0.0".
5:37:07 PM: warning "react-bricks-ui > react-simple-code-editor@0.11.0" has incorrect peer dependency "react-dom@^16.0.0".
5:37:07 PM: warning "react-bricks-ui > react-leaflet > @react-leaflet/core@1.1.1" has incorrect peer dependency "react@^17.0.1".
5:37:07 PM: warning "react-bricks-ui > react-leaflet > @react-leaflet/core@1.1.1" has incorrect peer dependency "react-dom@^17.0.1".
5:37:07 PM: warning " > react-chartjs-2@4.0.1" has incorrect peer dependency "react@^16.8.0 || ^17.0.0".
5:37:11 PM: [5/5] Building fresh packages...
5:37:11 PM: success Saved lockfile.
5:37:11 PM: $ remix setup node
5:37:12 PM: Successfully setup Remix for node.
5:37:12 PM: Done in 5.37s.
5:37:12 PM: NPM modules installed using Yarn
5:37:12 PM: Started restoring cached go cache
5:37:12 PM: Finished restoring cached go cache
5:37:12 PM: go version go1.16.5 linux/amd64
5:37:12 PM: go version go1.16.5 linux/amd64
5:37:12 PM: Installing missing commands
5:37:12 PM: Verify run directory
5:37:13 PM: β
5:37:13 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
5:37:13 PM: Netlify Build
5:37:13 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
5:37:13 PM: β
5:37:13 PM: β― Version
5:37:13 PM: @netlify/build 26.5.1
5:37:13 PM: β
5:37:13 PM: β― Flags
5:37:13 PM: baseRelDir: true
5:37:13 PM: buildId: 6249cd08225ace00089e4caa
5:37:13 PM: deployId: 6249cd08225ace00089e4cac
5:37:13 PM: β
5:37:13 PM: β― Current directory
5:37:13 PM: /opt/build/repo
5:37:13 PM: β
5:37:13 PM: β― Config file
5:37:13 PM: /opt/build/repo/netlify.toml
5:37:13 PM: β
5:37:13 PM: β― Context
5:37:13 PM: production
5:37:13 PM: β
5:37:13 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
5:37:13 PM: 1. build.command from netlify.toml
5:37:13 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
5:37:13 PM: β
5:37:13 PM: $ yarn build
5:37:14 PM: yarn run v1.22.18
5:37:14 PM: $ run-s build:*
5:37:14 PM: $ npm run generate:css -- --minify
5:37:15 PM: > generate:css
5:37:15 PM: > tailwindcss -o ./app/styles/tailwind.css "--minify"
5:37:16 PM: Done in 679ms.
5:37:16 PM: $ remix build
5:37:17 PM: Building Remix app in production mode...
5:37:18 PM: Built in 1.1s
5:37:18 PM: Done in 4.21s.
5:37:18 PM: β
5:37:18 PM: (build.command completed in 4.5s)
5:37:18 PM: β
5:37:18 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
5:37:18 PM: 2. Functions bundling
5:37:18 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
5:37:18 PM: β
5:37:18 PM: Packaging Functions from .netlify/functions-internal directory:
5:37:18 PM: - server.js
5:37:18 PM: β
5:37:18 PM: Packaging Functions from netlify/functions directory:
5:37:18 PM: - hello-world/main.go
5:37:18 PM: β
5:37:18 PM: β
5:37:18 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
5:37:18 PM: Dependencies installation error
5:37:18 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
5:37:18 PM: β
5:37:18 PM: Error message
5:37:18 PM: A Netlify Function failed to require one of its dependencies.
5:37:18 PM: Please make sure it is present in the site's top-level "package.json".
β
5:37:18 PM: In file "/opt/build/repo/.netlify/functions-internal/server.js"
5:37:18 PM: Cannot find module 'app'
5:37:18 PM: Require stack:
5:37:18 PM: - /opt/buildhome/node-deps/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/node/bundlers/zisi/resolve.js
5:37:18 PM: β
5:37:18 PM: Resolved config
5:37:18 PM: build:
5:37:18 PM: command: yarn build
5:37:18 PM: commandOrigin: config
5:37:18 PM: environment:
5:37:18 PM: - API_KEY
5:37:18 PM: - APP_ID
5:37:18 PM: - DATABASE_URL
5:37:18 PM: - SERVICE_ACCOUNT
5:37:18 PM: publish: /opt/build/repo/public
5:37:18 PM: publishOrigin: config
5:37:18 PM: functionsDirectory: /opt/build/repo/netlify/functions
5:37:18 PM: headers:
5:37:20 PM: - for: /build/*
values:
Cache-Control: public, max-age=31536000, s-maxage=31536000
GO_IMPORT_PATH: https://github.com/Crevitus/remix-reactbricks-typescript-netlify-starter
headersOrigin: config
redirects:
- from: /*
status: 200
to: /.netlify/functions/server
redirectsOrigin: config
Caching artifacts
5:37:20 PM: Started saving node modules
5:37:20 PM: Finished saving node modules
5:37:20 PM: Started saving build plugins
5:37:20 PM: Finished saving build plugins
5:37:20 PM: Started saving yarn cache
5:37:26 PM: Finished saving yarn cache
5:37:26 PM: Started saving pip cache
5:37:26 PM: Finished saving pip cache
5:37:26 PM: Started saving emacs cask dependencies
5:37:26 PM: Finished saving emacs cask dependencies
5:37:26 PM: Started saving maven dependencies
5:37:26 PM: Finished saving maven dependencies
5:37:26 PM: Creating deploy upload records
5:37:26 PM: Started saving boot dependencies
5:37:26 PM: Finished saving boot dependencies
5:37:26 PM: Started saving rust rustup cache
5:37:26 PM: Finished saving rust rustup cache
5:37:26 PM: Started saving go dependencies
5:37:26 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
5:37:26 PM: Finished saving go dependencies
5:37:26 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
5:37:26 PM: Failing build: Failed to build site
5:37:26 PM: Finished processing build request in 58.068849587s
Remix dev works fine locally. I cannot work out why this happens. All my site code lives in the folder /app as is default in Remix apps.
Site - https://bencrevis.uk/ (currently down as my previous deploy forgot to include the server.js file)
Repo - GitHub - Crevitus/personal-site
Thanks!