dword-design / nuxt-mail

Adds email sending capability to a Nuxt.js app. Adds a server route, an injected variable, and uses nodemailer to send emails.
Other
239 stars 18 forks source link

Error: "Cannot restart nuxt: SMTP config is missing" even though its configured #200

Closed urbgimtam closed 1 year ago

urbgimtam commented 1 year ago

Hope you're having a great day.

I've installed the latest version of nuxt-mail on nuxt3 (3.5.0) and I cannot start nuxt after the configuration.

nuxt-mail: 3.1.42 nuxt: 3.5.0 node version: 18

I've done a minimal codesandbox with it and behaves the same. https://codesandbox.io/p/sandbox/dreamy-wozniak-1n28zk

Error message:

 ERROR  SMTP config is missing. 

  at default (node_modules/nuxt-mail/dist/index.js:27:11)
  at installModule (node_modules/nuxt/node_modules/@nuxt/kit/dist/index.mjs:440:101)
  at async initNuxt (node_modules/nuxt/dist/index.mjs:2887:7)
  at async loadNuxt (node_modules/nuxt/dist/index.mjs:2950:5)
  at async loadNuxt (node_modules/@nuxt/kit/dist/index.mjs:545:19)
  at async Object.invoke (node_modules/nuxi/dist/chunks/prepare.mjs:31:18)
  at async _main (node_modules/nuxi/dist/cli.mjs:48:20)

npm ERR! code 1
npm ERR! path /home/projects/new-website
npm ERR! command failed
npm ERR! command sh -c nuxt prepare

nuxt.config.ts

export default defineNuxtConfig({
  modules: [
    [
      "nuxt-mail",
      {
        mail: {
          to: "example@example.com",
          smtp: {
            host: "smtp.example.com",
            port: 587,
          },
        },
      },
    ],
  ],
});
dword-design commented 1 year ago

@urbgimtam your config doesn't match the structure from the readme. rename main -> message, then move smtp out of message.

urbgimtam commented 1 year ago

šŸ¤¦ Sorry. Of course, you're right.

I actually had the correct syntax on the nuxt.config.ts file, but the typescript keep giving error regarding the missing "mail" object type, that I've moved it inside the modules and ketp the same structure.

My bad, sorry for issue.