Ember Octane generate component -gc errors 3.17.1

Hi there,

I’m trying to generate new octane components js and hbs.

I do this: ember g component foo -gc

It works in terms of adding them both to app/components/foo.js
app/components/foo.hbs

However, if I then ember serve, I get this:

(node:10255) UnhandledPromiseRejectionWarning: Error: EEXIST: file already exists, symlink ‘/home/username/workspace/polonious-dash/app/components/foo.js’ -> ‘/tmp/broccoli-10255PQnTimmXLkvP/out-544-broccoli_persistent_filter_template_compiler/polonious-dash/components/foo.js’ at Object.symlinkSync (fs.js:1011:3) at symlink (/home/username/workspace/polonious-dash/node_modules/symlink-or-copy/index.js:98:14) at symlinkOrCopySync (/home/username/workspace/polonious-dash/node_modules/symlink-or-copy/index.js:65:5) at /home/username/workspace/polonious-dash/node_modules/ember-cli-htmlbars/node_modules/broccoli-persistent-filter/index.js:322:16 at initializePromise (/home/username/workspace/polonious-dash/node_modules/ember-cli-htmlbars/node_modules/rsvp/dist/rsvp.js:523:7) at new Promise (/home/username/workspace/polonious-dash/node_modules/ember-cli-htmlbars/node_modules/rsvp/dist/rsvp.js:1017:35) at TemplateCompiler.Filter._handleFile (/home/username/workspace/polonious-dash/node_modules/ember-cli-htmlbars/node_modules/broccoli-persistent-filter/index.js:306:10)

… etc

I can get rid of this error by mv app/components/foo.hbs app/template/components/.

ember s then works ok.

Is there some switch I’m missing in package.json or one of the other ember config files that controls this behaviour, it feels like I’m half way there but broccoli is not happy…

ember -v ember-cli: 3.16.0 node: 12.16.1 (I’ve also tried 13.*) os: linux x64

hopefully relevant package.json bits:

“devDependencies”: { “@ember/optional-features”: “^1.3.0”, “ember-source”: “3.17.1”, },

“ember”: { “edition”: “octane” }

The main requirements for colocation are:

  • ember-cli >= 3.12.0
  • ember-source >= 3.13.0
  • ember-cli-htmlbars >= 4.2.0

The specific error you are seeing seems like one of these packages is not quite up to the requirements here.

If you have a colocated component in a test dummy app, is there a strait forward way to only include that in apps that are above ember 3.12?

What do you mean by “in a test dummy app”?

Like in

tests/dummy/app/components/my-component.{js,hbs}

Anything in an addon’s dummy app is ignored when building the addon for inclusion in a consuming app, so there’s no way I’m aware of to use stuff from it. The component in question should probably be added to the addon where it could be included in the addon build conditionally (or always of course).

And if you wanted to use code from an addon differently depending on the version of the host app I think you can use https://github.com/ember-cli/ember-cli-version-checker

Sure. I was including it in a acceptance test to ensure they where supported. So not concerned with consuming apps, just wanted to run a test against it.

Yea, the addon code supports both, but if you have a colocated component in your test dummy app, it will fail the tests in less then 3.12

I can just not include ember 3.12 in the ember try set, but was wondering if there was a strait forward way to either skip it or handle them without modifying the addon code

No, not really. The closest I’ve come is what I did here:

It basically sets up some additional trees that conditionally get merged into the dummy app only when on octane.

1 Like

Yea, ok. Forgot about the ember-cli-build file. I didn’t want it to be in the addon code. I thought about putting it in an a test addon and doing basically the same things Ok cool. Thanks! @rwjblue and @dknutsen