I’m working on upgrading my old blogging site from NextJS12 to NextJS13. I got it running locally and then when I push my changes it fails on the build. My site is running on my domain, ryan-james.dev and the site name in Netlify is ryan-james-dev. I’ve already added an NPM flag in my environment variables to use --legacy-peer-deps. It looks like the graphql node module is looking for a file incorrectly. I haven’t had this happen before so I’m not sure how to redirect the naming/searching for a node module. I’ve included a picture of the failed log and the package.json file.
8:47:48 AM: build-image version: 3ffff9df3d5419545acc1b673a54de348174406d (focal)
8:47:48 AM: buildbot version: 06bd328e5eb3b6956f9c6602486ecccce8b861a0
8:47:48 AM: Fetching cached dependencies
8:47:48 AM: Failed to fetch cache, continuing with build
8:47:48 AM: Starting to prepare the repo for build
8:47:49 AM: No cached dependencies found. Cloning fresh repo
8:47:49 AM: git clone --filter=blob:none https://github.com/ryanjames1729/ryan-james-dev
8:47:49 AM: Preparing Git Reference refs/heads/main
8:47:50 AM: Custom build command detected. Proceeding with the specified command: “next build”
8:47:51 AM: Starting to install dependencies
8:47:51 AM: Python version set to 3.8
8:47:51 AM: Attempting Ruby version 2.7.2, read from environment
8:47:52 AM: Using Ruby version 2.7.2
8:47:52 AM: Started restoring cached go cache
8:47:52 AM: Finished restoring cached go cache
8:47:52 AM: Installing Go version 1.17 (requested 1.17)
8:47:57 AM: go version go1.17 linux/amd64
8:47:57 AM: Using PHP version 8.0
8:47:58 AM: Downloading and installing node v16.20.2…
8:47:59 AM: Downloading https://nodejs.org/dist/v16.20.2/node-v16.20.2-linux-x64.tar.xz…
8:47:59 AM: Computing checksum with sha256sum
8:47:59 AM: Checksums matched!
8:48:01 AM: Now using node v16.20.2 (npm v8.19.4)
8:48:01 AM: Enabling Node.js Corepack
8:48:01 AM: Started restoring cached build plugins
8:48:01 AM: Finished restoring cached build plugins
8:48:01 AM: Started restoring cached corepack dependencies
8:48:01 AM: Finished restoring cached corepack dependencies
8:48:01 AM: No npm workspaces detected
8:48:01 AM: Started restoring cached node modules
8:48:01 AM: Finished restoring cached node modules
8:48:01 AM: Installing npm packages using npm version 8.19.4
8:48:09 AM: added 418 packages, and audited 419 packages in 7s
8:48:09 AM: 173 packages are looking for funding
8:48:09 AM: run npm fund
for details
8:48:09 AM: 4 vulnerabilities (3 moderate, 1 critical)
8:48:09 AM: To address all issues, run:
8:48:09 AM: npm audit fix
8:48:09 AM: Run npm audit
for details.
8:48:09 AM: npm packages installed
8:48:09 AM: Successfully installed dependencies
8:48:09 AM: Starting build script
8:48:10 AM: Detected 1 framework(s)
8:48:10 AM: “next” at version “13.5.6”
8:48:10 AM: Section completed: initializing
8:48:12 AM:
8:48:12 AM: Netlify Build
8:48:12 AM: ────────────────────────────────────────────────────────────────
8:48:12 AM:
8:48:12 AM: ❯ Version
8:48:12 AM: @netlify/build 29.31.0
8:48:12 AM:
8:48:12 AM: ❯ Flags
8:48:12 AM: baseRelDir: true
8:48:12 AM: buildId: 65771303c999e57ff2826c85
8:48:12 AM: deployId: 65771303c999e57ff2826c87
8:48:12 AM:
8:48:12 AM: ❯ Current directory
8:48:12 AM: /opt/build/repo
8:48:12 AM:
8:48:12 AM: ❯ Config file
8:48:12 AM: /opt/build/repo/netlify.toml
8:48:12 AM:
8:48:12 AM: ❯ Context
8:48:12 AM: production
8:48:12 AM:
8:48:12 AM: ❯ Installing plugins
8:48:12 AM: - @netlify/plugin-nextjs@4.41.2
8:48:23 AM:
8:48:23 AM: ❯ Using Next.js Runtime - v4.41.2
8:48:24 AM:
8:48:24 AM: @netlify/plugin-nextjs (onPreBuild event)
8:48:24 AM: ────────────────────────────────────────────────────────────────
8:48:24 AM:
8:48:24 AM: No Next.js cache to restore.
8:48:24 AM: Netlify configuration property “build.environment.NEXT_PRIVATE_TARGET” value changed.
8:48:24 AM:
8:48:24 AM: (@netlify/plugin-nextjs onPreBuild completed in 73ms)
8:48:24 AM:
8:48:24 AM: build.command from netlify.toml
8:48:24 AM: ────────────────────────────────────────────────────────────────
8:48:24 AM:
8:48:24 AM: $ next build
8:48:25 AM: No build cache found. Please configure build caching for faster rebuilds. Read more: No Cache Detected | Next.js
8:48:25 AM: Linting and checking validity of types …
8:48:26 AM: Creating an optimized production build …
8:48:31 AM: Failed to compile.
8:48:31 AM:
8:48:31 AM: ./node_modules/graphql-request/dist/index.js
8:48:31 AM: Module not found: Can"t resolve “graphql/language/parser”
8:48:31 AM: Module Not Found | Next.js
8:48:31 AM: Import trace for requested module:
8:48:31 AM: ./services/index.js
8:48:31 AM: ./components/CommentsForm.js
8:48:31 AM: ./pages/blog.js
8:48:31 AM: ./node_modules/graphql-request/dist/index.js
8:48:31 AM: Module not found: Can"t resolve “graphql/language/printer”
8:48:31 AM: Module Not Found | Next.js
8:48:31 AM: Import trace for requested module:
8:48:31 AM: ./services/index.js
8:48:31 AM: ./components/CommentsForm.js
8:48:31 AM: ./pages/blog.js
8:48:31 AM: > Build failed because of webpack errors
8:48:31 AM:
8:48:31 AM: “build.command” failed
8:48:31 AM: ────────────────────────────────────────────────────────────────
8:48:31 AM:
8:48:31 AM: Error message
8:48:31 AM: Command failed with exit code 1: next build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
8:48:31 AM:
8:48:31 AM: Error location
8:48:31 AM: In build.command from netlify.toml:
8:48:31 AM: next build
8:48:31 AM:
8:48:31 AM: Resolved config
8:48:31 AM: build:
8:48:31 AM: command: next build
8:48:31 AM: commandOrigin: config
8:48:31 AM: environment:
8:48:31 AM: - AUTH0_ID
8:48:31 AM: - AUTH0_ISSUER
8:48:31 AM: - AUTH0_SECRET
8:48:31 AM: - GITHUB_ID
8:48:31 AM: - GITHUB_SECRET
8:48:31 AM: - GOOGLE_ID
8:48:31 AM: - GOOGLE_SECRET
8:48:31 AM: - GRAPH_CMS_ENDPOINT
8:48:31 AM: - NEXTAUTH_SECRET
8:48:31 AM: - NEXTAUTH_URL
8:48:31 AM: - NPM_FLAGS
8:48:31 AM: - NEXT_PRIVATE_TARGET
8:48:31 AM: publish: /opt/build/repo/.next
8:48:31 AM: publishOrigin: config
8:48:31 AM: functionsDirectory: /opt/build/repo/netlify/functions
8:48:31 AM: plugins:
8:48:31 AM: - inputs: {}
8:48:31 AM: origin: ui
8:48:31 AM: package: “@netlify/plugin-nextjs”
8:48:32 AM: Failed during stage “building site”: Build script returned non-zero exit code: 2
8:48:32 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
8:48:32 AM: Failing build: Failed to build site
8:48:32 AM: Finished processing build request in 44.115s
{
“name”: “ryan-james-dev”,
“version”: “0.1.0”,
“private”: true,
“scripts”: {
“dev”: “next dev”,
“build”: “next build”,
“start”: “next start”,
“lint”: “next lint”
},
“dependencies”: {
“coffeeandfun/google-profanity-words”: “^1.0.4”,
“graphcms/rich-text-react-renderer”: “^0.5.0”,
“framer-motion”: “^6.3.6”,
“graphql-request”: “^4.3.0”,
“next”: “^13.5.6”,
“next-auth”: “^4.3.4”,
“react”: “^18.2.0”,
“react-dom”: “^18.2.0”,
“react-social-icons”: “^5.13.0”,
“remark”: “^14.0.2”,
“remark-html”: “^15.0.1”
},
“devDependencies”: {
“autoprefixer”: “^10.4.7”,
“eslint”: “8.16.0”,
“eslint-config-next”: “^13.5.6”,
“graphql-request”: “^4.3.0”,
“postcss”: “^8.4.14”,
“tailwindcss”: “^3.0.24”
}
}