Next/Image not found? #18882
-
Can I use the Image component from a separate folder? When I use it in the Components folder, it says "Module not found: Can't resolve 'next/image'", and I can't figure out if it is the wrong folder, or something else. |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 11 replies
-
You can use it in any folder within your Next.js project. What version are you running of Next? |
Beta Was this translation helpful? Give feedback.
-
Hello I got the same problem since 1 day... I'm sharing with you my json package to figured out what's going on {
"name": "showcase-front",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"next": "10.0.7",
"react": "17.0.1",
"react-device-detect": "^1.15.0",
"react-dom": "17.0.1",
"react-modal": "^3.12.1",
"react-use": "^17.1.1"
},
"devDependencies": {
"@types/node": "^14.14.31",
"@types/react": "^17.0.2",
"typescript": "^4.1.5"
}
} $ next build
ModuleNotFoundError: Module not found: Error: Can't resolve 'next/image' in '/Users/me///components/HomePage'
|
Beta Was this translation helpful? Give feedback.
-
Unfortunately I had the same issue and I couldnt fix it, and I was running the latest next 10.0.9, react 17.0.2 I removed the modules and .next and reinstall them all and still got the same error " Module not found: Can't resolve 'next/images' ". I had to go manual and not use this feature . |
Beta Was this translation helpful? Give feedback.
-
Solution that worked for me is by updating nextjs to the latest version. try this -> npm install next@latest |
Beta Was this translation helpful? Give feedback.
-
Had this same issue was very confused since everything ran locally but failed on deployment. Wrong: Right: |
Beta Was this translation helpful? Give feedback.
-
If somebody still has this issue and none of the above worked try this: Open |
Beta Was this translation helpful? Give feedback.
You can use it in any folder within your Next.js project. What version are you running of Next?