Ember JS: define is not defined

Asked By: Anonymous

I recently upgraded my app from Ember 1.3 to Ember 2.4.2. However after deploying it to my production environment with ember build --env production I noticed a couple of issues.

The first issue was that each script/stylesheet tag had a integrity attribute attached to it which made it impossible to load those resources. After some investigation I decided to just replace the value for those attributes to be empty. This allowed the app to download the resources but I then noticed an error in the console that said define is not defined on the minified website.js file that Ember creates. I’m unable to replicate this issue locally because the app runs fine. What steps can I additionally take to investigate this issue? Could this be related to some addon that I have installed, or maybe the SRI integrity attribute that I removed?

Edit: I just tried building and deploying a vanilla app with Ember (e.g. ember new testApp and ember build --env production and encountered the same issue. Is there an issue with Ember that I don’t know about? I don’t think it’s my server since I’m able to render a plain index.html just fine.


Solution

Answered By: Anonymous

I prefer to use the latest NodeJS (v5.8) and the latest npm.
You can update your npm with npm install -g npm.
The best way to install NodeJS

I guess, you have the latest ember-cli. You can update it if you are outside of your project:

$ cd ~
$ npm install -g ember-cli

I just cloned your repository.

$ git clone https://github.com/uioporqwerty/website.git
$ cd website
$ npm install && bower install
$ ember server

Got the following error:

➜  website git:(master) ember s
version: 2.4.2
The Broccoli Plugin: [ConfigLoader] failed with:
Error: Attempting to watch missing directory: config
    at EventEmitter.Watcher_addWatchDir [as addWatchDir] (/Users/szines/projects/temp/website/node_modules/broccoli-sane-watcher/index.js:90:11)
    at /Users/szines/projects/temp/website/node_modules/ember-cli-broccoli/lib/builder.js:95:35
   ...

Because of a couple of important files are missing from your ember-cli project, I just run ember init

$ ember init

During this process you see a question. You can check suggested changes with ‘d’, but it would just remove bootstrap and font-awesome, which is fine, because we will reinstall them with ember install.

[?] Overwrite bower.json? (Yndh) Y

Now we remove all the previous bower and npm package, temp folder and dist folder.

$ rm -rf bower_components node_modules tmp dist
$ npm install && bower install

Install ember-bootstrap and ember-font-awesome:

$ ember install ember-bootstrap
$ ember install ember-font-awesome

Launch the server:

$ ember server

Your app working like a charm. Open localhost:4200 in your browser.

You can build the production:

$ ember build --prod

And all the files will be in /dist folder.

Or run the production version with the server:

$ ember server --prod

Enjoy your new Ember! 🙂

Update:

You can use ember-cli-update for updating your Ember app:

$ npx ember-cli-update
$ npx ember-cli-update --run-codemods

Source: Update Ember.js app

techinplanet staff

techinplanet staff


Windows 10 Kaufen Windows 10 Pro Office 2019 Kaufen Office 365 Lizenz Windows 10 Home Lizenz Office 2019 Home Business Kaufen windows office 365 satın al follower kaufen instagram follower kaufen porno