The `link-to` keyword was used incorrectly error during build

Hello, I am in the process of upgrading a couple of older (> 7 year old) Ember.js apps. I recently upgraded a lot of the packages but when I run ember build, I get the following error:

The `link-to` keyword was used incorrectly. It was used as a call expression, but its valid usages are:

- As an append statement, as in: {{link-to}}

- As a block statement, as in: {{#link-to}}{{/link-to}}

Error caused by:

|  {{link-to "Cancel" cancelRoutePath class="btn btn-link"}}

According the syntax I have used, everything looks correct. What am I missing?

Hmmm that does look correct to me but as you know it’s extremely old Ember so who really knows… what happens if you just try using the block form? e.g.

{{#link-to cancelRoutePath class="btn btn-link"}}Cancel{{/link-to}}
1 Like

@dknutsen thanks for the reply! Changing my code to look like yours does work. I was just trying to avoid having to do it ALL over this app and others I am trying to upgrade haha

Yeah I know what you mean there. The inline version still seems like it should work to me, especially because it totally says so in the error you got. But when upgrading it’s always a tradeoff between “do the super tedious broad scale fix” or “spend a bunch of time messing around with something in the hopes that you can avoid it” and you never know which will be harder in the long run. Sounds like you’ve got a lot of upgrading to do, so good luck!

I’m not sure how well people really remember the Ember 1.x series or even the 2.x at this point but don’t hesitate to reach out here or in Discord if you get stuck.

1 Like