Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while deploying #3

Closed
dpetrovaliev opened this issue Oct 5, 2023 · 4 comments
Closed

Error while deploying #3

dpetrovaliev opened this issue Oct 5, 2023 · 4 comments

Comments

@dpetrovaliev
Copy link
Contributor

$ /Users/{MY_USER}/Code/nuxtjs-test-app/node_modules/.bin/ts-node stack/index.ts
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /Users/{MY_USER}/Code/nuxtjs-test-app/stack/index.ts
at new NodeError (node:internal/errors:405:5)
at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:99:9)
at defaultGetFormat (node:internal/modules/esm/get_format:142:36)
at defaultLoad (node:internal/modules/esm/load:120:20)
at ModuleLoader.load (node:internal/modules/esm/loader:388:13)
at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:270:56)
at new ModuleJob (node:internal/modules/esm/module_job:65:26)
at ModuleLoader.#createModuleJob (node:internal/modules/esm/loader:282:17)
at ModuleLoader.getJobFromResolveResult (node:internal/modules/esm/loader:240:34)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:221:17) {
code: 'ERR_UNKNOWN_FILE_EXTENSION'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Subprocess exited with error 1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
CDK Nuxt Deployment Error: CDK deployment failed.

@ferdinandfrank
Copy link
Owner

Hi @dpetrovaliev,
can you please check, if you have set "type": "module" within your package.json?
If so, please remove it and retry the deployment.

If it still fails, also make sure that you have set the following part within your tsconfig.json:

  "compilerOptions": {
    "module": "CommonJS"
  },

I also found a related post on StackOverflow which might further help with this:
https://stackoverflow.com/questions/62096269/cant-run-my-node-js-typescript-project-typeerror-err-unknown-file-extension

@dpetrovaliev
Copy link
Contributor Author

Hi @ferdinandfrank
Thanks for your response!

I already tried the options that you suggested but I haven't been able to fix it. I'm still getting that Error.
I just want to mention that I'm trying your package on a freshly installed Nuxt app with the latest version they have published.
Also attaching my tsconfig.json:

{
  // https://nuxt.com/docs/guide/concepts/typescript
  "extends": "./.nuxt/tsconfig.json",
  "compilerOptions": {
    "module": "CommonJS",
  },
}

@dpetrovaliev
Copy link
Contributor Author

Ahh... my bad I haven’t saved the package.json properly with the removed "type": "module".
And now when I fix was credentials in my AWS CLI it should work. 🤞

But still, I think that you need to specify these settings in your Setup steps.

@ferdinandfrank
Copy link
Owner

Glad to hear that! 😊

Yes, you are right. I'll add it to the setup steps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants