Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to setup project according to getting started guide / Could not find module ember-engines/routes #2361

Open
janikvonrotz opened this issue Mar 27, 2023 · 4 comments

Comments

@janikvonrotz
Copy link

janikvonrotz commented Mar 27, 2023

Hi

I tried to familiarize myself with the calluma project and therefore tried to setup a demo instance using this guide: https://caluma.gitbook.io/caluma-docs/guides/guide

In the end I got a blank page in the browser and this error:

Uncaught Error: Could not find module `ember-engines/routes` imported from `@projectcaluma/ember-form-builder/routes`

I assume this can be resolved by using the exact Node / NPM / Ember versions.

Server

Started the docker project according to the guide.

Client

Installed the ember dependencies:

~ nvm use v18.15.0
Now using node v18.15.0 (npm v9.5.0)

➜  ~ npm install -g ember-cli

➜  ~ ember new caluma-demo
installing app
Ember CLI v4.11.0

➜  ~ cd caluma-demo
➜  caluma-demo git:(master) npm start

The server started. Next I installed the ember projectcaluma package:

➜  caluma-demo git:(master) ember install @projectcaluma/ember-form-builder @projectcaluma/ember-form

And updated the files according to the guidE:

router.js

import EmberRouter from '@ember/routing/router';
import config from 'caluma-demo/config/environment';

export default class Router extends EmberRouter {
  location = config.locationType;
  rootURL = config.rootURL;
}

Router.map(function() {
  this.mount("@projectcaluma/ember-form-builder", {
    as: "form-builder",
    path: "/form-builder"
  });
});

app.js

import Application from '@ember/application';
import Resolver from 'ember-resolver';
import loadInitializers from 'ember-load-initializers';
import config from 'caluma-demo/config/environment';

export default class App extends Application {
  modulePrefix = config.modulePrefix;
  podModulePrefix = config.podModulePrefix;
  Resolver = Resolver;

  engines = {
    "@projectcaluma/ember-form-builder": {
      dependencies: {
        services: [
          "apollo", // ember-apollo-client for graphql
          "notification", // ember-uikit for notifications
          "intl", // ember-intl for i18n
          "caluma-options", // service to configure ember-caluma
          "validator" // service for generic regex validation
        ]
      }
    }
  }

}

loadInitializers(App, config.modulePrefix);

It seems the extend instruction have change, not sure if this works.

environment.js

'use strict';

module.exports = function (environment) {
  const ENV = {
    modulePrefix: 'caluma-demo',
    environment,
    rootURL: '/',
    locationType: 'history',
    EmberENV: {
      EXTEND_PROTOTYPES: false,
      FEATURES: {
        // Here you can enable experimental features on an ember canary build
        // e.g. EMBER_NATIVE_DECORATOR_SUPPORT: true
      },
    },
    apollo: {
      apiURL: "/graphql"
    },
    APP: {
      // Here you can pass flags/options to your application instance
      // when it is created
    },
  };

  //..

ember-cli-build.js

'use strict';

const EmberApp = require('ember-cli/lib/broccoli/ember-app');

module.exports = function (defaults) {
  const app = new EmberApp(defaults, {
    "ember-uikit": {
      notification: {
        "timeout": 5000,
        "group": null,
        "pos": "top-center",
      }
    }
  });

  //..

app.scss

Does not exist anymore. It seems ember has removed scss suppport.

Last step I did:

➜  caluma-demo git:(master) ✗ npm start

And then got the error.

@czosel
Copy link
Contributor

czosel commented Apr 10, 2023

Hi @janikvonrotz

Thank you for the detailed bug report and sorry about the late reply! I was able to reproduce the issue. We currently have an issue with the 0.9.x release of ember-engines: ember-engines/ember-engines#833

For me, explicitly installing an older version of ember-engines fixes the issue - can you try and see if this does the trick for you as well?

npm install [email protected]

We'll still have to come up with a minimal reproduction of the issue to facilitate an upstream fix for this.

@czosel
Copy link
Contributor

czosel commented Apr 10, 2023

Also, we've just extended the Guide with some more details on how to get SCSS styling to work. Hope this helps! 🙂

@janikvonrotz
Copy link
Author

@czosel Thanks I will check the provided fix asap.

@czosel
Copy link
Contributor

czosel commented Apr 18, 2023

@janikvonrotz Turns out the root cause for the issue with ember-engines >= 0.9 was caused by another addon we maintain, ember-uikit. If you make sure you have the latest release of ember-uikit (7.0.3), you don't need to downgrade ember-engines anymore 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants