Debowerifying Ember causes error - ember.js

I have installed ember as a bower component:
bower install ember
The debowerify transform is applied like so:
var debowerify = require('debowerify');
browserify().
.transform(debowerify)
.require('./bower_components/ember/ember.js')
.bundle()
.pipe(source('vendor.js'))
.pipe(gulp.dest('./build'));
When I run the above as a gulp task, it shows me the error:
```
[07:38:56] Starting 'browserify'...
[07:38:56] Running 'bundle'...
events.js:72
throw er; // Unhandled 'error' event
^
Error: Cannot find module '../package.json' from 'app_root/bower_components/ember'
at app_root/node_modules/browserify/node_modules/resolve/lib/async.js:43:25
at load (app_root/node_modules/browserify/node_modules/resolve/lib/async.js:61:43)
at app_root/node_modules/browserify/node_modules/resolve/lib/async.js:67:22
at app_root/node_modules/browserify/node_modules/resolve/lib/async.js:21:47
at Object.oncomplete (fs.js:107:15)
```
On inspecting the ember.js file from the bower_components/ember directory, saw the following code:
var packageVersion = require('../package.json').version;
I am not sure how to resolve this issue and make debowerify play nice with Ember. I have created a repo that demonstrates the problem: https://github.com/saravanak/ember-debowerify

Related

Chart.js zoom plugin: Unexpected identifier error in console

I am trying to test chart.js zoom plugin example (from official examples folder) locally. Example file name is zoom.html
I changed scripts paths to local paths in the example code:
<script src="Chart.bundle.js"></script>
<script src="hammer.min.js"></script>
<script src="chartjs-plugin-zoom.js"></script>
All scripts are latest versions:
Chart.js: 2.7.3
Hammer.js: 2.0.8
chartjs-plugin-zoom: does not have version number, but latest downloaded from github
The zoom does not work and I see the error in console:
Uncaught SyntaxError: Unexpected identifier
in line 3 of chartjs-plugin-zoom.js
so it seems like
import Chart from 'chart.js';
line in the plugin code works wrong. Or maybe I am doing wrong something.
The same error happened when I tried other locations of the libraries.
You can run the examples by doing:
git clone https://github.com/chartjs/chartjs-plugin-zoom.git
cd chartjs-plugin-zoom
npm install
gulp build

Ember serve doesn't work (Error: Couldn't find preset "es2015")

I am building a web app using Ember. I created the project with ember new test-app and have made no changes to the generated files. When I run ember serve, I immediately receive the following error:
The Broccoli Plugin: [BroccoliMergeTrees: Addon#compileAddon(ember-welcome-page) ] failed with:
Error: Couldn't find preset "es2015" relative to directory "/Users/jacob"
at /Users/jacob/Desktop/test-app/node_modules/babel-core/lib/transformation/file/options/option-manager.js:293:19
at Array.map ()
at OptionManager.resolvePresets (/Users/jacob/Desktop/test-app/node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20)
at OptionManager.mergePresets (/Users/jacob/Desktop/test-app/node_modules/babel-core/lib/transformation/file/options/option-manager.js:264:10)
at OptionManager.mergeOptions (/Users/jacob/Desktop/test-app/node_modules/babel-core/lib/transformation/file/options/option-manager.js:249:14)
at OptionManager.init (/Users/jacob/Desktop/test-app/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
at File.initOptions (/Users/jacob/Desktop/test-app/node_modules/babel-core/lib/transformation/file/index.js:212:65)
at new File (/Users/jacob/Desktop/test-app/node_modules/babel-core/lib/transformation/file/index.js:135:24)
at Pipeline.transform (/Users/jacob/Desktop/test-app/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
at Promise (/Users/jacob/Desktop/test-app/node_modules/broccoli-babel-transpiler/lib/parallel-api.js:102:26)
The broccoli plugin was instantiated at:
at BroccoliMergeTrees.Plugin (/Users/jacob/Desktop/test-app/node_modules/broccoli-plugin/index.js:7:31)
at new BroccoliMergeTrees (/Users/jacob/Desktop/test-app/node_modules/ember-cli/node_modules/broccoli-merge-trees/index.js:16:10)
at Function.BroccoliMergeTrees [as _upstreamMergeTrees] (/Users/jacob/Desktop/test-app/node_modules/ember-cli/node_modules/broccoli-merge-trees/index.js:10:53)
at mergeTrees (/Users/jacob/Desktop/test-app/node_modules/ember-cli/lib/broccoli/merge-trees.js:85:33)
at Class.compileAddon (/Users/jacob/Desktop/test-app/node_modules/ember-cli/lib/models/addon.js:1092:12)
at Class.treeForAddon (/Users/jacob/Desktop/test-app/node_modules/ember-cli/lib/models/addon.js:746:26)
at Class.treeForAddon (/Users/jacob/Desktop/test-app/node_modules/ember-welcome-page/index.js:27:41)
at Class.superWrapper [as treeForAddon] (/Users/jacob/Desktop/test-app/node_modules/core-object/lib/assign-properties.js:34:20)
at Class._treeFor (/Users/jacob/Desktop/test-app/node_modules/ember-cli/lib/models/addon.js:557:33)
at Class.treeFor (/Users/jacob/Desktop/test-app/node_modules/ember-cli/lib/models/addon.js:517:21)
I referred to this question for help, but I still received the same error after trying the solution.
I am running ember-cli v2.16.2 and node v8.9.0 on macOS High Sierra. In my node installation, the only three global modules I have installed are bower, broccoli-cli, and ember-cli.
Please do clean reinstall of ember-cli package.
npm uninstall -g ember-cli
npm cache clean --force
npm install -g ember-cli
Then run your ember new command once again and test it.

` ember server` throws error, not able to run the app

I am a absolute new with emberjs. I am just following this tutorial to create my first app : http://yoember.com/ but as like tutorials instruction I am running ember server but I thrown with error like :
The Broccoli Plugin: [ConfigReplace] failed with:
Error: Build Canceled: Broccoli Builder ran into an error with Funnel plugin. �
at new BroccoliBuildError (F:\EmberJS\libraray-app\node_modules\broccoli-builder\lib\broccoli-build-error.js:40:9)
at F:\EmberJS\libraray-app\node_modules\broccoli-builder\lib\builder.js:168:19
at tryCatch (F:\EmberJS\libraray-app\node_modules\rsvp\dist\rsvp.js:539:12)
at invokeCallback (F:\EmberJS\libraray-app\node_modules\rsvp\dist\rsvp.js:554:13)
at publish (F:\EmberJS\libraray-app\node_modules\rsvp\dist\rsvp.js:522:7)
at publishRejection (F:\EmberJS\libraray-app\node_modules\rsvp\dist\rsvp.js:457:3)
at flush (F:\EmberJS\libraray-app\node_modules\rsvp\dist\rsvp.js:2414:5)
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)
The broccoli plugin was instantiated at:
at ConfigReplace.Plugin (F:\EmberJS\libraray-app\node_modules\broccoli-plugin\index.js:7:31)
at new ConfigReplace (F:\EmberJS\libraray-app\node_modules\broccoli-config-replace\index.js:13:10)
at EmberApp.index (F:\EmberJS\libraray-app\node_modules\ember-cli\lib\broccoli\ember-app.js:686:12)
at EmberApp.toArray (F:\EmberJS\libraray-app\node_modules\ember-cli\lib\broccoli\ember-app.js:1661:12)
at EmberApp.toTree (F:\EmberJS\libraray-app\node_modules\ember-cli\lib\broccoli\ember-app.js:1684:38)
at module.exports (F:\EmberJS\libraray-app\ember-cli-build.js:22:14)
at Builder.setupBroccoliBuilder (F:\EmberJS\libraray-app\node_modules\ember-cli\lib\models\builder.js:56:19)
at new Builder (F:\EmberJS\libraray-app\node_modules\ember-cli\lib\models\builder.js:30:10)
at ServeTask.run (F:\EmberJS\libraray-app\node_modules\ember-cli\lib\tasks\serve.js:24:55)
at Promise.resolve.then (F:\EmberJS\libraray-app\node_modules\ember-cli\lib\models\command.js:242:46)
Livereload server on http://localhost:49153
How to fix this?

setting up ember-calender

Hi I am trying to use ember-calender library
I did the following thing
npm install ember-cli-moment
updated .jshintrc with moment: true
npm install ember-cli-calendar from emberaddons.com site
and
in login.hbs
<h2>Login</h2>
{{ember-calendar
eventsMode=eventsMode
gridMode='month'
allEvents=eventList
}}
I am getting error
Uncaught Error: <venuehunt#view:default::ember522> Handlebars error: Could not find property 'ember-calendar' on object <venuehunt#controller:login::ember396>.
VM204:993ProfileManager.ended VM204:993flush
VM204:2067fn vendor.js:13478DeferredActionQueues.invoke
vendor.js:13808DeferredActionQueues.flush vendor.js:13858Backburner.end
vendor.js:13321Backburner.run vendor.js:13376executeTimers
vendor.js:13701(anonymous function)
I faced a similar issue the other day.
It appears that Ember does not see the addon 'ember-calendar' and tries to look it up as a property from controllers.
The solution was adding the addon to project's package.json devDependencies:
{
....
"ember-cli-calendar": "*"
}
A shortcut for adding would be:
npm install ember-cli-calendar --save-dev
Hope this helps!

ember-data initialization error: "Uncaught TypeError"

I have just downloaded ember-1.0.0-pre.4.js and ember-data-latest.js and get the following error upon the initialization of the app:
Uncaught TypeError: Object Ember.Application has no method 'registerInjection'
How can I fix this?
Unfortunately ember-data-latest.js on GitHub isn't up-to-date with Ember Pre 4. You'll have to git clone the Ember DS repository, and then build them using rake.
You can find it here or the minified version from here
you can get it from http://cdnjs.com/ concretely:
//cdnjs.cloudflare.com/ajax/libs/ember-data.js/0.8.0-latest20121123/ember-data-latest.min.js
//cdnjs.cloudflare.com/ajax/libs/ember-data.js/0.8.0-latest20121123/ember-data-latest.js