I got an Error when using Rewrites in NextJS by using references in NextJS Documentation
I tried to reinstall node_modules but it still not working
Enviroment Variables is working, but rewrites feature is not working
This is my next.config.js
module.exports = {
env: {
APPNAME: 'NextJS Exercise!!!',
},
async rewrites() {
return [
{
source: '/login',
destination: '/auth/login',
},
]
},
}
This is the error what i got
TypeError: (0 , _resolveRewrites.default) is not a function
Next.config.js Code
The Error
I encountered this problem before with a clean nextjs project.
There is a quick fix:
npm install
again.If the above cannot help, please try to upgrade the nextjs package to 10.2.0
,
npm install next@latest
I had the same issue, the solution from @Mic doesn't work unfortunately for me, but when I clean the cache first it works so run this in order
Then if you are using yarn:
yarn cache clean
rm -rf node_modules yarn.lock && yarn install
Or if you are using npm:
npm cache clean
rm -rf node_modules package-lock.json && npm install
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With