简体   繁体   English

我用的是<img>使用图像链接在 Next.js 中标记,它显示错误

[英]I was using a <Image /> tag in Next.js using a link of an image and it was showing an error

I have tried it several times but the error was the same.我已经尝试了几次,但错误都是一样的。
I have also created the next.config.js file我还创建了 next.config.js 文件

module.exports = {
    images: {
      domains: ['link.papareact.com', ],
    },
  };


Error: Invalid src prop (https://links.papareact.com/ua6) on `next/image`, hostname "links.papareact.com" is not configured under images in your `next.config.js`
See more info: https://nextjs.org/docs/messages/next-image-unconfigured-host

any solution for this asap.尽快解决这个问题。

Try this :尝试这个 :

 module.exports = { images: { domains: ['link.papareact.com/*'] } };

module.exports = {
  images: {
    domains: ['links.papareact.com']
  }
};

It will be "links" instead of link.它将是“链接”而不是链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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