简体   繁体   中英

Next js Strapi - error - TypeError: fetch failed

Module build failed: UnhandledSchemeError: Reading from "node:assert" is not handled by plugins (Unhandled scheme). Webpack supports "data:" and "file:" URIs by default. You may need an additional plugin to handle "node:" URIs.

I had the same problem with next 12.3.1 and STRAPI VERSION v4.4.1. It was due to the strapi was running on node 16 and next was running on 18. Check your version of next and strapi installation by running

  • node -v (in terminal in the root folder of both next and strapi) if they are different run
  • nvm install v16 (for the nextjs root)
  • nvm use 16 (on the nextjs root)

This solved my issue. (also remember to pass an absolute URL for the fetch)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM