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

Could not find a declaration file for module 'cors'. #3319

Closed
billantoniadis opened this issue Oct 20, 2023 · 3 comments · Fixed by #3348
Closed

Could not find a declaration file for module 'cors'. #3319

billantoniadis opened this issue Oct 20, 2023 · 3 comments · Fixed by #3348

Comments

@billantoniadis
Copy link

Hello. I created a new application using npm create feathers@latest feathers-chat and I am able to successfully compile and run my application. As soon as I add authentication (as shown below), I am no longer able to compile. Did I miss a step? Am I doing something wrong, or is this a defect?

$ node --version
v18.18.0

$ npx feathers generate authentication
? Which authentication methods do you want to use? Other methods and providers can be added at any time. Auth0
? What is your authentication service name? user
? What path should the service be registered on? users
? What database is the service using? SQL
? Which schema definition format do you want to use? Schemas allow to type, validate, secure and populate data TypeBox  (recommended)
    Updated src/client.ts
    Wrote file src/services/users/users.schema.ts
    Wrote file src/services/users/users.ts
    Updated src/services/index.ts
    Wrote file src/services/users/users.shared.ts
    Wrote file test/services/users/users.test.ts
    Wrote file src/services/users/users.class.ts
    Wrote file migrations/20231020172649_user.ts
    Wrote file src/authentication.ts
    Updated src/app.ts
    Wrote file test/client.test.ts
    Updated src/declarations.ts
    Running npm install --save

added 73 packages, and audited 458 packages in 4s

71 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
$ npm run compile

> [email protected] compile
> shx rm -rf lib/ && tsc

node_modules/@feathersjs/express/lib/index.d.ts:3:18 - error TS7016: Could not find a declaration file for module 'cors'. '/home/bill/Projects/Streamline/gva.web/app/node_modules/cors/lib/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/cors` if it exists or add a new declaration (.d.ts) file containing `declare module 'cors';`

3 import cors from 'cors';
                   ~~~~~~


Found 1 error in node_modules/@feathersjs/express/lib/index.d.ts:3
@daffl
Copy link
Member

daffl commented Oct 23, 2023

I am not able to reproduce this. Is this consistently reproducible? What are the options you chose?

@billantoniadis
Copy link
Author

Thank you for the reply, David. I am able to consistently reproduce using the options listed above (what I selected is shown after the question mark). Note that Auth0 is the only authentication method I selected. I am able to easily work around this by including "@types/cors": "^2.8.15" to the "devDepencies" in package.json. It's just strange that it is happening.

@fidelio314
Copy link

hi @billantoniadis i had the same issue.
and i have one more:
#3322

anyway for the cors i added the type

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

Successfully merging a pull request may close this issue.

3 participants