cloudflare / next-on-pages

CLI to build and develop Next.js apps for Cloudflare Pages
https://www.npmjs.com/package/@cloudflare/next-on-pages
MIT License
1.27k stars 121 forks source link

[🐛 Bug]: vercel not found during next-on-pages 1.5.1 build #443

Closed zionfuo closed 8 months ago

zionfuo commented 1 year ago

next-on-pages environment related information

error Command "vercel" not found.

Description

When running a build, there is an error saying that vercel is not found.

Reproduction

This has occurred through multiple builds executed via GitHub Actions. No changes to config have occurred, issue only started happening today.

Pages Deployment Method

Pages CI (GitHub/GitLab integration)

Pages Deployment ID

11ab859

Additional Information

package version

node version: v18.17.1 yran version: 1.22.17

10:17:12.318 | ⚡️ @cloudflare/next-on-pages CLI v.1.5.1
-- | --
10:17:12.899 | ⚡️ Detected Package Manager: yarn (classic)
10:17:12.899 | ⚡️ Preparing project...
10:17:12.902 | ⚡️ Project is ready
10:17:13.585 | ⚡️ Building project...
10:17:13.893 | ▲  yarn run v1.22.17
10:17:13.946 | ▲  error Command "vercel" not found.
10:17:13.946 | ▲  info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
10:17:13.963 |  
10:17:13.963 | ⚡️ The Vercel build (`yarn vercel build`) command failed. For more details see the Vercel logs above.
10:17:13.963 | ⚡️ If you need help solving the issue, refer to the Vercel or Next.js documentation or their repositories.
10:17:13.964 |  
10:17:14.013 | Failed: Error while executing user command. Exited with error code: 1
10:17:14.024 | Failed: build command exited with code: 1
10:17:15.014 | Failed: error occurred while running build command

Would you like to help?

operfildoluiz commented 1 year ago

Happening on Node v18.16.0, yarn v1.22.17. Started suddenly, no new packages added. Just pushed a regular commit.

dario-piotrowicz commented 1 year ago

Hi @zionfuo, thank you for the issue :slightly_smiling_face:

The bug should have already been fixed by 1.6.0 could you please try to give that version a go and let me know how it goes? :pray:

(@operfildoluiz same for you, please give 1.6.0 a try :slightly_smiling_face:)

operfildoluiz commented 1 year ago

@dario-piotrowicz updating to 1.6.0 alone didn't fix it. Had to add vercel as a dev dependency, then it started working again :)

dario-piotrowicz commented 1 year ago

@operfildoluiz are you completely sure you were using 1.6.0? did you double check the version in the command logs? :sweat:

operfildoluiz commented 1 year ago

@dario-piotrowicz yeah, triple checked. I had to push a few commits changing back to 1.5.0, assuming it woudl work as before, but was still failing due to the lock file. Then I created brand new one, upgraded to 1.6.0, failed again.

Then I added vercel as a dependency and it worked like a charm

zionfuo commented 1 year ago

Hi @zionfuo, thank you for the issue 🙂

The bug should have already been fixed by 1.6.0 could you please try to give that version a go and let me know how it goes? 🙏

(@operfildoluiz same for you, please give 1.6.0 a try 🙂)

@dario-piotrowicz The current version is already 1.6, but it seems that the build failure is due to the JavaScript exceeding 500KB.

Build log

2023-08-29T00:22:06.515351Z Cloning repository...
2023-08-29T00:22:07.900119Z From https://github.com/moepool/moe-web
2023-08-29T00:22:07.900819Z  * branch            527243b1f172fb33fadfb285db10ec6c48fad50a -> FETCH_HEAD
2023-08-29T00:22:07.901009Z 
2023-08-29T00:22:09.011382Z HEAD is now at 527243b Update .babelrc
2023-08-29T00:22:09.012275Z 
2023-08-29T00:22:09.142423Z 
2023-08-29T00:22:09.178364Z Success: Finished cloning repository files
2023-08-29T00:22:11.142Z    Detected the following tools from environment: nodejs@18.17.1, yarn@1.22.19
2023-08-29T00:22:11.143558Z Installing nodejs 18.17.1
2023-08-29T00:22:11.80658Z  Trying to update node-build... ok
2023-08-29T00:22:12.088955Z Downloading node-v18.17.1-linux-x64.tar.gz...
2023-08-29T00:22:12.089323Z -> https://nodejs.org/dist/v18.17.1/node-v18.17.1-linux-x64.tar.gz
2023-08-29T00:22:13.954756Z Installing node-v18.17.1-linux-x64...
2023-08-29T00:22:15.550954Z Installed node-v18.17.1-linux-x64 to /opt/buildhome/.asdf/installs/nodejs/18.17.1
2023-08-29T00:22:15.551542Z 
2023-08-29T00:22:17.479682Z Preparing yarn@1.22.19 for immediate activation...
2023-08-29T00:22:18.353541Z Installing project dependencies: yarn --pure-lockfile --no-progress --emoji false
2023-08-29T00:22:19.054915Z yarn install v1.22.19
2023-08-29T00:22:19.158256Z [1/4] Resolving packages...
2023-08-29T00:22:19.527902Z [2/4] Fetching packages...
2023-08-29T00:22:56.897685Z [3/4] Linking dependencies...
2023-08-29T00:22:56.8997Z   warning " > cssnano-preset-simple@3.0.0" has unmet peer dependency "postcss@^8.2.15".
2023-08-29T00:22:56.901796Z warning " > @next/mdx@11.0.1" has unmet peer dependency "@mdx-js/react@*".
2023-08-29T00:22:56.910342Z warning "next-pwa > babel-loader@8.2.2" has unmet peer dependency "webpack@>=2".
2023-08-29T00:22:56.910719Z warning "next-pwa > clean-webpack-plugin@3.0.0" has unmet peer dependency "webpack@*".
2023-08-29T00:22:56.911086Z warning "next-pwa > terser-webpack-plugin@5.1.4" has unmet peer dependency "webpack@^5.1.0".
2023-08-29T00:22:56.911432Z warning "next-pwa > workbox-webpack-plugin@6.1.5" has unmet peer dependency "webpack@^4.4.0 || ^5.9.0".
2023-08-29T00:22:56.91204Z  warning " > file-loader@6.2.0" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
2023-08-29T00:22:56.912588Z warning " > styled-components@5.3.0" has unmet peer dependency "react-is@>= 16.8.0".
2023-08-29T00:22:56.914857Z warning " > raw-loader@4.0.2" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
2023-08-29T00:23:33.215289Z [4/4] Building fresh packages...
2023-08-29T00:23:35.61997Z  $ husky install
2023-08-29T00:23:35.740344Z husky - Git hooks installed
2023-08-29T00:23:35.750683Z Done in 76.70s.
2023-08-29T00:23:35.836919Z Executing user command: npx @cloudflare/next-on-pages@1
2023-08-29T00:23:39.099136Z npm WARN exec The following package was not found and will be installed: @cloudflare/next-on-pages@1.6.0
2023-08-29T00:23:45.470821Z npm WARN deprecated rollup-plugin-inject@3.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.
2023-08-29T00:23:45.583464Z npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
2023-08-29T00:23:50.461282Z ⚡️ @cloudflare/next-on-pages CLI v.1.6.0
2023-08-29T00:23:51.02466Z  ⚡️ Detected Package Manager: yarn (classic)
2023-08-29T00:23:51.02524Z  ⚡️ Preparing project...
2023-08-29T00:23:51.028556Z ⚡️ Project is ready
2023-08-29T00:23:51.971668Z ⚡️ vercel dev dependency missing, installing vercel as a dev dependency with 'yarn add vercel -D'...
2023-08-29T00:23:52.272992Z ▲  yarn add v1.22.19
2023-08-29T00:23:52.397668Z ▲  [1/4] Resolving packages...
2023-08-29T00:23:53.991705Z ▲  [2/4] Fetching packages...
2023-08-29T00:23:59.816216Z ▲  [3/4] Linking dependencies...
2023-08-29T00:23:59.817745Z ▲  warning " > cssnano-preset-simple@3.0.0" has unmet peer dependency "postcss@^8.2.15".
2023-08-29T00:23:59.819475Z ▲  warning " > @next/mdx@11.0.1" has unmet peer dependency "@mdx-js/react@*".
2023-08-29T00:23:59.826563Z ▲  warning "next-pwa > babel-loader@8.2.2" has unmet peer dependency "webpack@>=2".
2023-08-29T00:23:59.82691Z  ▲  warning "next-pwa > clean-webpack-plugin@3.0.0" has unmet peer dependency "webpack@*".
2023-08-29T00:23:59.827319Z ▲  warning "next-pwa > terser-webpack-plugin@5.1.4" has unmet peer dependency "webpack@^5.1.0".
2023-08-29T00:23:59.827567Z ▲  warning "next-pwa > workbox-webpack-plugin@6.1.5" has unmet peer dependency "webpack@^4.4.0 || ^5.9.0".
2023-08-29T00:23:59.827751Z ▲  warning " > file-loader@6.2.0" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
2023-08-29T00:23:59.828124Z ▲  warning " > styled-components@5.3.0" has unmet peer dependency "react-is@>= 16.8.0".
2023-08-29T00:23:59.830281Z ▲  warning " > raw-loader@4.0.2" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
2023-08-29T00:24:14.038966Z ▲  [4/4] Building fresh packages...
2023-08-29T00:24:14.403695Z ▲  success Saved lockfile.
2023-08-29T00:24:14.553207Z ▲  success Saved 70 new dependencies.
2023-08-29T00:24:14.554639Z ▲  info Direct dependencies
2023-08-29T00:24:14.554877Z ▲  └─ vercel@32.1.0
2023-08-29T00:24:14.55505Z  ▲  info All dependencies
2023-08-29T00:24:14.55519Z  ▲  ├─ @cspotcode/source-map-support@0.8.1
2023-08-29T00:24:14.555554Z ▲  ├─ @edge-runtime/cookies@3.4.0
2023-08-29T00:24:14.555839Z ▲  ├─ @edge-runtime/format@2.2.0
2023-08-29T00:24:14.556018Z ▲  ├─ @edge-runtime/node-utils@2.2.0
2023-08-29T00:24:14.556193Z ▲  ├─ @mapbox/node-pre-gyp@1.0.11
2023-08-29T00:24:14.556327Z ▲  ├─ @ts-morph/common@0.11.1
2023-08-29T00:24:14.556454Z ▲  ├─ @tsconfig/node10@1.0.9
2023-08-29T00:24:14.556596Z ▲  ├─ @tsconfig/node12@1.0.11
2023-08-29T00:24:14.556729Z ▲  ├─ @tsconfig/node14@1.0.3
2023-08-29T00:24:14.556855Z ▲  ├─ @tsconfig/node16@1.0.4
2023-08-29T00:24:14.556995Z ▲  ├─ @vercel/error-utils@2.0.1
2023-08-29T00:24:14.557143Z ▲  ├─ @vercel/gatsby-plugin-vercel-analytics@1.0.10
2023-08-29T00:24:14.557272Z ▲  ├─ @vercel/gatsby-plugin-vercel-builder@2.0.3
2023-08-29T00:24:14.557404Z ▲  ├─ @vercel/go@3.0.0
2023-08-29T00:24:14.557538Z ▲  ├─ @vercel/hydrogen@1.0.0
2023-08-29T00:24:14.557681Z ▲  ├─ @vercel/next@4.0.1
2023-08-29T00:24:14.557811Z ▲  ├─ @vercel/python@4.0.0
2023-08-29T00:24:14.557936Z ▲  ├─ @vercel/redwood@2.0.0
2023-08-29T00:24:14.558078Z ▲  ├─ @vercel/remix-builder@2.0.2
2023-08-29T00:24:14.55821Z  ▲  ├─ @vercel/ruby@2.0.0
2023-08-29T00:24:14.558335Z ▲  ├─ @vercel/static-build@2.0.3
2023-08-29T00:24:14.558461Z ▲  ├─ abbrev@1.1.1
2023-08-29T00:24:14.558598Z ▲  ├─ aproba@2.0.0
2023-08-29T00:24:14.558725Z ▲  ├─ are-we-there-yet@2.0.0
2023-08-29T00:24:14.558857Z ▲  ├─ arg@4.1.3
2023-08-29T00:24:14.558982Z ▲  ├─ async-listen@3.0.0
2023-08-29T00:24:14.559245Z ▲  ├─ async-sema@3.1.1
2023-08-29T00:24:14.559385Z ▲  ├─ bindings@1.5.0
2023-08-29T00:24:14.559521Z ▲  ├─ busboy@1.6.0
2023-08-29T00:24:14.55965Z  ▲  ├─ chownr@2.0.0
2023-08-29T00:24:14.559776Z ▲  ├─ code-block-writer@10.1.1
2023-08-29T00:24:14.559898Z ▲  ├─ color-support@1.1.3
2023-08-29T00:24:14.560019Z ▲  ├─ console-control-strings@1.1.0
2023-08-29T00:24:14.560168Z ▲  ├─ content-type@1.0.5
2023-08-29T00:24:14.560293Z ▲  ├─ convert-hrtime@3.0.0
2023-08-29T00:24:14.560416Z ▲  ├─ create-require@1.1.1
2023-08-29T00:24:14.560555Z ▲  ├─ delegates@1.0.0
2023-08-29T00:24:14.560682Z ▲  ├─ detect-libc@2.0.2
2023-08-29T00:24:14.560806Z ▲  ├─ diff@4.0.2
2023-08-29T00:24:14.56093Z  ▲  ├─ edge-runtime@2.5.0
2023-08-29T00:24:14.561067Z ▲  ├─ esbuild-linux-64@0.14.47
2023-08-29T00:24:14.561197Z ▲  ├─ estree-walker@2.0.2
2023-08-29T00:24:14.561328Z ▲  ├─ etag@1.8.1
2023-08-29T00:24:14.561457Z ▲  ├─ exit-hook@2.2.1
2023-08-29T00:24:14.561604Z ▲  ├─ file-uri-to-path@1.0.0
2023-08-29T00:24:14.561731Z ▲  ├─ fs-extra@11.1.0
2023-08-29T00:24:14.561858Z ▲  ├─ fs-minipass@2.1.0
2023-08-29T00:24:14.561993Z ▲  ├─ gauge@3.0.2
2023-08-29T00:24:14.562137Z ▲  ├─ has-unicode@2.0.1
2023-08-29T00:24:14.562266Z ▲  ├─ json-schema-to-ts@1.6.4
2023-08-29T00:24:14.562391Z ▲  ├─ make-error@1.3.6
2023-08-29T00:24:14.562523Z ▲  ├─ minizlib@2.1.2
2023-08-29T00:24:14.562649Z ▲  ├─ mkdirp@1.0.4
2023-08-29T00:24:14.562773Z ▲  ├─ mri@1.2.0
2023-08-29T00:24:14.5629Z   ▲  ├─ node-fetch@2.6.9
2023-08-29T00:24:14.563023Z ▲  ├─ nopt@5.0.0
2023-08-29T00:24:14.563164Z ▲  ├─ npmlog@5.0.1
2023-08-29T00:24:14.563293Z ▲  ├─ parse-ms@2.1.0
2023-08-29T00:24:14.563421Z ▲  ├─ path-browserify@1.0.1
2023-08-29T00:24:14.563553Z ▲  ├─ pretty-ms@7.0.1
2023-08-29T00:24:14.563679Z ▲  ├─ set-blocking@2.0.0
2023-08-29T00:24:14.563802Z ▲  ├─ streamsearch@1.1.0
2023-08-29T00:24:14.563935Z ▲  ├─ tar@6.1.15
2023-08-29T00:24:14.56408Z  ▲  ├─ time-span@4.0.0
2023-08-29T00:24:14.564237Z ▲  ├─ ts-toolbelt@6.15.5
2023-08-29T00:24:14.564365Z ▲  ├─ undici@5.23.0
2023-08-29T00:24:14.564495Z ▲  ├─ v8-compile-cache-lib@3.0.1
2023-08-29T00:24:14.56463Z  ▲  ├─ vercel@32.1.0
2023-08-29T00:24:14.564757Z ▲  ├─ wide-align@1.1.5
2023-08-29T00:24:14.56488Z  ▲  └─ yn@3.1.1
2023-08-29T00:24:14.57736Z  ▲  $ husky install
2023-08-29T00:24:14.696494Z ▲  husky - Git hooks installed
2023-08-29T00:24:14.705925Z ▲  Done in 22.44s.
2023-08-29T00:24:14.776204Z ⚡️ Install completed
2023-08-29T00:24:14.776639Z ⚡️ Building project...
2023-08-29T00:24:15.091572Z ▲  yarn run v1.22.19
2023-08-29T00:24:15.138665Z ▲  $ /opt/buildhome/repo/node_modules/.bin/vercel build
2023-08-29T00:24:15.780883Z ▲  Vercel CLI 32.1.0
2023-08-29T00:24:17.017756Z ▲  Installing dependencies...
2023-08-29T00:24:17.380063Z ▲  [1/4] Resolving packages...
2023-08-29T00:24:17.78207Z  ▲  success Already up-to-date.
2023-08-29T00:24:17.800353Z ▲  $ husky install
2023-08-29T00:24:17.919461Z ▲  husky - Git hooks installed
2023-08-29T00:24:17.957507Z ▲  Detected Next.js version: 12.1.0
2023-08-29T00:24:17.961356Z ▲  Running "yarn run build"
2023-08-29T00:24:18.238342Z ▲  $ next build
2023-08-29T00:24:18.885208Z ▲  info  - Loaded env from /opt/buildhome/repo/.env
2023-08-29T00:24:20.315887Z ▲  Attention: Next.js now collects completely anonymous telemetry regarding usage.
2023-08-29T00:24:20.31709Z  ▲  This information is used to shape Next.js' roadmap and prioritize features.
2023-08-29T00:24:20.317533Z ▲  You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
2023-08-29T00:24:20.317814Z ▲  https://nextjs.org/telemetry
2023-08-29T00:24:20.511394Z ▲  info  - Checking validity of types...
2023-08-29T00:24:52.773906Z ▲  ./src/pages/MinerDashboard/Settings/PayoutSettings/ThresholdInput.tsx
2023-08-29T00:24:52.774499Z ▲  40:6  Warning: React Hook useMemo has a missing dependency: 'isBTC'. Either include it or remove the dependency array.  react-hooks/exhaustive-deps
2023-08-29T00:24:52.774697Z ▲  
2023-08-29T00:24:52.774844Z ▲  info  - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
2023-08-29T00:24:52.782045Z ▲  info  - Creating an optimized production build...
2023-08-29T00:24:52.790551Z ▲  warn  - using beta Middleware (not covered by semver) - https://nextjs.org/docs/messages/beta-middleware
2023-08-29T00:24:52.816375Z ▲  info  - Disabled SWC as replacement for Babel because of custom Babel configuration ".babelrc" https://nextjs.org/docs/messages/swc-disabled
2023-08-29T00:24:52.866905Z ▲  > [PWA] Compile client (static)
2023-08-29T00:24:52.870182Z ▲  > [PWA] Custom worker found: /opt/buildhome/repo/worker/index.js
2023-08-29T00:24:52.870521Z ▲  > [PWA] Build custom worker: /opt/buildhome/repo/public/worker-W1Jpcd3wq34nT8gb0WN0p.js
2023-08-29T00:24:52.949625Z ▲  > [PWA] Auto register service worker with: /opt/buildhome/repo/node_modules/next-pwa/register.js
2023-08-29T00:24:52.950085Z ▲  > [PWA] Service worker: /opt/buildhome/repo/public/service-worker.js
2023-08-29T00:24:52.950407Z ▲  > [PWA]   url: /service-worker.js
2023-08-29T00:24:52.950633Z ▲  > [PWA]   scope: /
2023-08-29T00:24:53.432321Z ▲  > [PWA] Compile server
2023-08-29T00:24:53.941121Z ▲  info  - Using external babel configuration from /opt/buildhome/repo/.babelrc
2023-08-29T00:25:43.959485Z ▲  [BABEL] Note: The code generator has deoptimised the styling of /opt/buildhome/repo/node_modules/@amcharts/amcharts4/.internal/pdfmake/vfs_fonts.js as it exceeds the max of 500KB.
2023-08-29T00:26:25.625651Z ▲  Failed to compile.
2023-08-29T00:26:25.626287Z ▲  
2023-08-29T00:26:25.626501Z ▲  ./src/pages/GetStarted/Nicehash/assets/nh_1.jpg
2023-08-29T00:26:25.626654Z ▲  TypeError: Failed to parse URL from /opt/buildhome/repo/node_modules/next/dist/server/lib/squoosh/mozjpeg/mozjpeg_node_dec.wasm
2023-08-29T00:26:25.62679Z  ▲  at Object.fetch (node:internal/deps/undici/undici:11576:11)
2023-08-29T00:26:25.626919Z ▲  
2023-08-29T00:26:25.627063Z ▲  Import trace for requested module:
2023-08-29T00:26:25.627198Z ▲  ./src/pages/GetStarted/Nicehash/NicehashGuide.page.tsx
2023-08-29T00:26:25.627332Z ▲  ./pages/get-started/[ticker]/nicehash.tsx
2023-08-29T00:26:25.627485Z ▲  
2023-08-29T00:26:25.627619Z ▲  ./src/pages/GetStarted/Nicehash/assets/nh_2.jpg
2023-08-29T00:26:25.62776Z  ▲  TypeError: Failed to parse URL from /opt/buildhome/repo/node_modules/next/dist/server/lib/squoosh/mozjpeg/mozjpeg_node_dec.wasm
2023-08-29T00:26:25.627891Z ▲  at Object.fetch (node:internal/deps/undici/undici:11576:11)
2023-08-29T00:26:25.628018Z ▲  
2023-08-29T00:26:25.628173Z ▲  Import trace for requested module:
2023-08-29T00:26:25.628302Z ▲  ./src/pages/GetStarted/Nicehash/NicehashGuide.page.tsx
2023-08-29T00:26:25.628436Z ▲  ./pages/get-started/[ticker]/nicehash.tsx
2023-08-29T00:26:25.628565Z ▲  
2023-08-29T00:26:25.628704Z ▲  ./src/pages/GetStarted/Nicehash/assets/nh_3.jpg
2023-08-29T00:26:25.628833Z ▲  TypeError: Failed to parse URL from /opt/buildhome/repo/node_modules/next/dist/server/lib/squoosh/mozjpeg/mozjpeg_node_dec.wasm
2023-08-29T00:26:25.628958Z ▲  at Object.fetch (node:internal/deps/undici/undici:11576:11)
2023-08-29T00:26:25.629108Z ▲  
2023-08-29T00:26:25.62924Z  ▲  Import trace for requested module:
2023-08-29T00:26:25.62937Z  ▲  ./src/pages/GetStarted/Nicehash/NicehashGuide.page.tsx
2023-08-29T00:26:25.629508Z ▲  ./pages/get-started/[ticker]/nicehash.tsx
2023-08-29T00:26:25.629714Z ▲  
2023-08-29T00:26:25.629892Z ▲  > Build failed because of webpack errors
2023-08-29T00:26:25.73127Z  ▲  error Command failed with exit code 1.
2023-08-29T00:26:25.731661Z ▲  info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
2023-08-29T00:26:25.761825Z ▲  Error: Command "yarn run build" exited with 1
2023-08-29T00:26:25.864449Z ▲  error Command failed with exit code 1.
2023-08-29T00:26:25.865051Z ▲  info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
2023-08-29T00:26:25.883323Z 
2023-08-29T00:26:25.883791Z ⚡️ The Vercel build (`yarn vercel build`) command failed. For more details see the Vercel logs above.
2023-08-29T00:26:25.884116Z ⚡️ If you need help solving the issue, refer to the Vercel or Next.js documentation or their repositories.
2023-08-29T00:26:25.884398Z 
2023-08-29T00:26:25.900198Z npm notice 
2023-08-29T00:26:25.900798Z npm notice New minor version of npm available! 9.6.7 -> 9.8.1
2023-08-29T00:26:25.901249Z npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.8.1>
2023-08-29T00:26:25.901558Z npm notice Run `npm install -g npm@9.8.1` to update!
2023-08-29T00:26:25.901736Z npm notice 
2023-08-29T00:26:25.925016Z Failed: Error while executing user command. Exited with error code: 1
2023-08-29T00:26:25.940674Z Failed: build command exited with code: 1
2023-08-29T00:26:27.192084Z Failed: error occurred while running build command
dodrian commented 1 year ago

I'm getting a similar error when building with next-on-pages in CI (have only just encountered this, but this may be because we were previously just using next build to upload a static site, and I'm migrating to next-on-pages to leverage some of the edge stuff).

Running locally with yarn install and then yarn next-on-pages works fine, but when I do the same in the docker container that we use in CI I get the following error:

⚡️ @cloudflare/next-on-pages CLI v.1.6.0
⚡️ Detected Package Manager: yarn (classic)
⚡️ Preparing project...
⚡️ Project is ready
⚡️ Building project...
▲  error Command "vercel" not found.
▲  info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

⚡️ The Vercel build (`yarn vercel build`) command failed. For more details see the Vercel logs above.
⚡️ If you need help solving the issue, refer to the Vercel or Next.js documentation or their repositories.

Here's the (stripped down for privacy) dockerfile we're using:


FROM alpine

RUN apk add --no-cache \
    yarn \
    nodejs-current 

COPY /package.json /yarn.lock /

RUN --mount=type=cache,target=/usr/local/share/.cache/yarn/v6 \
    yarn install --network-timeout 240000 \ 

ENV PATH="${PATH}:/node_modules/.bin"

CMD ["/bin/bash"]

This unusual setup means that /node_modules is in a different location than the working directory (/code). We do it in order to cache node_modules/ and not have to reinstall in every ci run. I think next-on-pages is then failing to find and execute the vercel script from this non-standard location - but next-on-pages ran fine because we had explicitly added it to our path.

Our solution to fix the error was adding a step to our build script. After mounting our /code directory, we create a symbolic link to the root /node_modules folder. I'm not sure if our error is strictly the fault of next-on-pages, but I hope this observation helps others with debugging.

dario-piotrowicz commented 1 year ago

@zionfuo the 500kb issue you're getting seems to come from Babel: https://github.com/babel/babel/blob/5d1fb54c6b295c973942cdb34ecb01bf49bc2a7d/packages/babel-generator/src/index.ts#L107-L108

I am not really too familiar with Babel but it looks like you should be able to fix that by setting this compact flag in your .babelrc file: https://babeljs.io/docs/options#compact

did you try that?

dario-piotrowicz commented 8 months ago

I think that the original issue has been resolved a while back, so I'm closing this

@zionfuo if you still have some issues (like the 500KB one) please feel free to open a new issue for that 🙏