I have a nextjs project which to test locally i need to run on on https, i have seen there is a –experimental-https command but when i run it i am getting
Unknown or unexpected option: --experimental-https
my project is "next": "14.2.3"
even when i create a new app i still get the warning, infact i also get a warning
The `app` directory is experimental. To enable, add `appDir: true` to your `next.config.js` configuration under `experimental`. See https://nextjs.org/docs/messages/experimental-app-dir-config
and i have to add a next.config.js with
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
appDir: true,
}
}
module.exports = nextConfig
I have tried updating next js but feel i must be doing something wrong.
Any suggestions would be appriciated.
2
Answers
I had to remove all traces of node.js and then re install it (even thought i already had the latest version installed)
for run Next.js server locally on HTTPS you should run this script on terminal:
next dev --experimental-https
or change package.json file scripts like this:
"dev": "next dev --experimental-https"}
and after that in terminal you can runnpm run dev