Unable to create homepage, ReferenceError: HomePage is not defined

Hi. Followed the excellent getting started guide creating posts. This was ver. 0.7.0. I want to use RWjs for an existing database so I created a new project, ran db introspect and save and created a homepage using ‘yarn rw g page home /’. But that fails with the ‘ReferenceError: HomePage is not defined’ and then identifies the offending line:

<Route path="/" page={HomePage} name="home" />

But HomePage.js is there:

const HomePage = () => {
....
}

export default HomePage

This is 0.8.0.

regards
Claus

Hi @kometen Thanks for taking a dive into Redwood! Let’s see if we can get things back on track – this is strange behavior indeed.

We’ll need your system info. Could you paste the info in a reply from runningyarn rw info?

Quick potential fix: did you try stop/starting the dev-server? I ran into something yesterday that feels suspiciously similar and had to restart.

If that doesn’t work, we’d need to see some code snippets or even a link to a repo to try and reproduce. So maybe an overview of your Routes.js and a screenshot of your web/src/ dir structure down to HomePage.js?

Thanks again!

Hey @thedavid / @kometen

I am experiencing the same issue. I haven’t started writing any of my own code, and am experiencing this on the first step of the intro tutorial. Running yarn rw info returns:

System:
    OS: macOS Mojave 10.14.6
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 14.3.0 - /var/folders/hr/_36svmjj7s1clsfknlyknk8m0000gn/T/yarn--1590772183486-0.8573116175838942/node
    Yarn: 1.22.4 - /var/folders/hr/_36svmjj7s1clsfknlyknk8m0000gn/T/yarn--1590772183486-0.8573116175838942/yarn
  Databases:
    SQLite: 3.24.0 - /usr/bin/sqlite3
  Browsers:
    Chrome: 83.0.4103.61
    Firefox: 72.0.1
    Safari: 13.1.1
  npmPackages:
    @redwoodjs/core: ^0.8.0 => 0.8.0

Also, the “Reference” link on the site does not lead anywhere. :upside_down_face:

1 Like

Let me try to reproduce this!

I’m able to reproduce this, I’ll debug and fix this, and we’ll release a v0.8.1 in the next few hours.

2 Likes

Thanks, @peterp! I saw the lighting launch at jamstackconf, and am excited to take the framework for a spin!

1 Like

@peterp I might be a bit late to the party here, but could this have anything to do with the new Babel plugin for routes?

1 Like

I think so, I’m looking into this now.

@peterp If it helps any: it seems to work fine if I import the HomePage manually. Oddly, secondary routes (e.g., AboutPage) start working without having to be manually imported when that HomePage route is imported.

Hi.

Thank you for your response. Yes, I did restart the dev-server. As @cbmunro also mentions it seemed to work when another route was added using “yarn rw g page foo”. But that seemed inconsistent.

So I ended up creating a project from scratch and downgrade to 0.7.0.

Thank you.

1 Like

Issue in the repo: https://github.com/redwoodjs/redwood/issues/626

Thanks again to everyone who’s helped with this. And, most of all, our apologies this bug snuck through! We’ll keep improving the process.

Short-term solution:

Downgrade all @redwoodjs packages to v0.7.0 .

Anyone who is starting a new Create Redwood project will currently be using v0.7.0 – we rolled-back the upgrade.

@cbmunro @kometen A heads up that this is now fixed in v0.8.1.

To upgrade to the latest release please run yarn rw upgrade

2 Likes

I just tried to update to v0.8.1 and this issue is still present.

I also just tried to “downgrade” by using yarn create redwood-app@0.7.0 redwoodblog and I get the following errors:

yarn create v1.22.4
[1/4] Resolving packages...
Couldn't find any versions for "create-redwood-app" that matches "0.7.1"
? Please choose a version of "create-redwood-app" from this list: 0.7.0-canary.0
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...

success Installed "create-redwood-app@0.7.0-canary.0" with binaries:
      - create-redwood-app
/bin/sh: 1: /home/davidrhoderick/.yarn/bin/create-redwood-app@0.7.1: not found
error Command failed.
Exit code: 127
Command: /home/davidrhoderick/.yarn/bin/create-redwood-app@0.7.1
Arguments: redwoodblog
Directory: /home/davidrhoderick/Development/redwoodjs-tutorial
Output:

info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.

Hi All, thanks again for the help here! We’ve replicated the issue as well and are continuing to work on the fix.

:point_right:The quick-fix is to downgrade all @redwoodjs packages to v0.7.0.

The installation template has been downgraded to v0.7.0, which means new projects started with yarn create ... are not experiencing this bug.**

Working issue in GitHub:

Thank you for the work. I just tried a clean install on 0.8.1 and that works. Adding a page is OK. Removing the same page does not seems to delete the generated files and folders. Adding the pages table and chair and removing them again “yarn rw (g / d) page furniture” keeps routes and relevant files.

The upgrade-process is smooth.

Adding the page unit (yarn rw g page unit) works. But adding the page test fails. So does chair, table.

This is yarn rw info:

System:
OS: macOS 10.15.5
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 14.3.0 - /var/folders/dz/w_xw0l1d2zsc6dfnjjrtqbnm0000gn/T/yarn–1590907957755-0.20562096231742077/node
Yarn: 1.22.4 - /var/folders/dz/w_xw0l1d2zsc6dfnjjrtqbnm0000gn/T/yarn–1590907957755-0.20562096231742077/yarn
Databases:
SQLite: 3.28.0 - /usr/bin/sqlite3
Browsers:
Firefox: 76.0.1
Safari: 13.1.1
npmPackages:
@redwoodjs/core: ^0.8.1 => 0.8.1

Fortunately I did a git checkout -b upgrade before the upgrade so I can revert.

Regards
Claus

This has been fixed in v0.8.2

This was a multi-layered problem having to do with Babel config. So we can all say a huge Thank You to @peterp for the solution! :tada:

If you’re interested, here’s the PR: Following tutorial and getting "ReferenceError: AboutPage is not defined" · Issue #630 · redwoodjs/redwood · GitHub

New Redwood installations are now using v0.8.2.

Release Notes + How to Upgrade

There were a few other changes in this version, which you can read in the v0.8.2 Release Notes.

For existing projects, the easiest way to upgrade is to use the following command:

yarn rw upgrade
2 Likes

Nice. :slight_smile:

0.8.2 seems to have solved the issue. I could add (and delete) chair and table and the routes were removed afterwards.

Looks great.

Regards
Claus

2 Likes