Redwood: Scaffold generation fails

Created on 15 Mar 2020  Â·  10Comments  Â·  Source: redwoodjs/redwood

The generation of scaffolds as (described](https://redwoodjs.com/tutorial/getting-dynamic) in the tutorial fails.
Steps to reproduce:

  1. yarn create redwood-app ./redwoodblog
  2. Add to schema: model Post {
    id Int @id @default(autoincrement())
    title String
    body String
    createdAt DateTime @default(now())
    }
  3. yarn redwood db save
  4. yarn rw db up
  5. yarn rw g scaffold post
  6. yarn redwood dev
    Results in:
    ./src/pages/PostsPage/PostsPage.js 7:71-83
    "export 'default' (imported as 'PostsCell') was not found in '../../components/PostsCell'
    Seems like the generation of the cells fails for Scaffolds
kinbug kinquestion

Most helpful comment

With the new release of 0.2.5, this is fixed. Thank you.

All 10 comments

In that list of commands above you didn't actually run the scaffold generator...are you missing a step?

Sorry i forgot to write down that step

@Domino987 These are the files that I generate:
image

I noticed that your code is referencing PostsCell, could you have made a typo?

If not, could you let us know a bit about your system, maybe share your ./redwoodblog folder somewhere?

It generates these files, but the import fails and I do not know why. I tried it several times with different configurations. Here is the repo: https://github.com/Domino987/blog . What do you mean with typo?
Here is the error message:

6:68-77
"export 'default' (imported as 'PostsCell') was not found in '../../components/PostsCell'

I hope this helps. Thank you in advance for your time.

@Domino987 I tried with your example repo, and this is working normally for me. What page in that app are you seeing the problem? Also did you try restarting your dev server?

I suspect @Domino987 experienced this problem when navigating to http://localhost:8910/posts after generating the Post scaffolding as I am experiencing the same issue.

In the developer tools I am seeing the following error being thrown -

image

In looking into it further the problem seems to originate from web/src/components/PostCell/PostsCell.js not having a export default. If I set the default to Empty then I could get the page to display properly to enter and save a post. Setting to Success didn't fix the issue or display the saved Post. Just thought you would like to know.

Hi @Domino987 I cloned your repo locally. From a quick glance, your files+code looked ok but I was also seeing the same console error as above. I then re-ran the db “save” and “up”:

  1. yarn rw db save
  2. yarn rw db up

After these steps, the migration was successful and the console Errors then resolved. It seems you might have been caught between making changes to the schema and/or services files that were never updated in the database itself. Could you try these steps (again) and see if things are working now as expected?

Lastly, here’s a reference repo example showing the final state of the tutorial (not 100% current but very close):
https://github.com/cannikin/redwoodblog

Please do confirm whether or not this issue has been resolve. Thanks!

Unfortunately not, but it might be connected to #240 and my windows. So I will check, if that fixes it. Thanks for your time.

With the new release of 0.2.5, this is fixed. Thank you.

David's suggestion fixed the issue for me as well. 👍

Was this page helpful?
0 / 5 - 0 ratings