Identifier has already been declared

Hello!

I’m trying to destroy a Scaffold running yarn rw d scaffold <scaffold>, but I’m getting this error message

Identifier ‘keyboard’ has already been declared. (5:2)

This message came from a file that doesn’t even exist and I deleted previously

RedwoodJS version: 3.4.0
I’m using Windows platform

I am also receiving this error when trying to generate a scaffold in a brand new project on 3.5.0.:

PS I:\webstorm_projects\gisPortal> yarn rw g scaffold notcorridor
× I:\webstorm_projects\gisPortal\api\src\services\notcorridors\notcorridors.test.ts: Identifier 'notcorridor' has already been declared. (5:2)

  3 | import {
  4 |   notcorridors,
> 5 |   notcorridor,
    |   ^
  6 |   createNotcorridor,
  7 |   updateNotcorridor,
  8 |   deleteNotcorridor,
■ Install helper packages
■ Adding layout import...
■ Adding set import...
■ Adding scaffold routes...
■ Adding scaffold asset imports...
■ Generating types ...
I:\webstorm_projects\gisPortal\api\src\services\notcorridors\notcorridors.test.ts: Identifier 'notcorridor' has already been declared. (5:2)

  3 | import {
  4 |   notcorridors,
> 5 |   notcorridor,
    |   ^
  6 |   createNotcorridor,
  7 |   updateNotcorridor,
  8 |   deleteNotcorridor,
PS I:\webstorm_projects\gisPortal> 

I do not have this directory:

I was able to generate a scaffold for the user model just fine.

1 Like

I got the same error on a new project I started yesterday. I’ve generated scaffolds for my two models and then I had to rename one of them and then, after renaming it, I tried generating the scaffold again & got this weird error saying the same thing: “Identifier […] has already been declared”. The main trouble is that this error is coming from the service test file, which I tried deleting, regenerating, etc. but the error is the same no matter what I do, the only solution I managed to work was recreating the entire project and only keeping the DB connection string on .env

i have same issue .
it’s because of first letter of your model name most be capital

1 Like