Error installing ember-cli-mocha - ember.js

I'm trying to setup an EmberJS project using ember-cli. I want to be able to use Mocha/Chai instead of the default qunit, but I am getting an error at the first step on installing ember-cli-mocha.
I create the new ember project with ember new my-project and then from within the project folder I run ember install ember-cli-mocha, selecting Yes to overwrite the tests/test-helper.js.
In the output, immediately following the Installed browser packages via Bower. message I see:
Package ember-cli/ember-cli-test-loader=ember-cli/ember-cli-test-loader not found
I can't find any information on this directly. I've tried installing the various packages themselves, before the ember-cli-mocha package via npm and bower, but I always get that message when installing ember-cli-mocha through ember-cli.
Anyone else have experience with this? Thanks in advance!

Related

ionic cordova plugin add cordova-plugin-advanced-http already installed

I am new on Ionic Mobile application development, so I am trying to POST data from Ionic app. Whenever I have run the app in browser using
ionic cordova run browser
It display below issue in console,
Native: tried calling HTTP.post, but the HTTP plugin is not installed.
Install the HTTP plugin: 'ionic cordova plugin add cordova-plugin-advanced-http'.
I have installed same plugin using terminal but terminal give warnings as its already installed.
Please Suggest.
Based on this https://ionicframework.com/docs/native/http/ you also need to run
npm install --save #ionic-native/http
and referencing it correctly in your app, please take a look at above link
Also for running app in browser try below command
Ionic serve
See https://github.com/ionic-team/ionic-native/issues/1975
The issue appears to have been fixed but there might be a lag in updating npm
I hade the same problem and I solve it with uninstall and reinstall the plugin
Uninstall plugin completely
ionic cordova plugin remove cordova-plugin-advanced-http
npm uninstall #ionic-native/http
and reinstall it
ionic cordova plugin add cordova-plugin-advanced-http
npm install #ionic-native/http
The Native Http plugin is the only way to handle the CORS from the client-side.
The way I see your problem, there might two possible fixes
Check whether the plugin is called after the platform.ready().
Even after it, if doesn't work or show the same error then follow this method.
// Declare cordova as a global constant
declare const cordova;
// directly call the cordova pulgin using "cordova.pulgin.http"
cordova.plugin.http.post(apiUrl, {}, {},
response => {},
response => {})

How to create a ember version specific project?

When i use,
ember new projname
project is getting created with 2.7.0 ember version. I want to create a older version ember project. What i should use? [i checked options that can be used with new command, but none helps for this.]
Here's what I ended up doing:
create a new directory for my project and cd inside of it
npm init (enter through some bogus details, doesn't matter, we're going to erase soon)
npm install --save-dev ember-cli#desired.version
delete package.json and package-lock.json
ember new app
This got me a node_modules folder with the desired version of ember, and then also allowed me to use the ember cli to generate a project. It will create a folder with the name of the app, of course, and you can safely delete the node_modules folder in the app's parent directory.
This feels like a little bit of a round-about way of doing things, but it worked, and it seemed easier than trying to mess with my global versions.
Hope this helps someone out!
Ember new will create project at the most current version installed on your system.
There are 2 ways around this.
Install an older version of ember-cli globally for the desired version. The benefit would be that you create a new app at the desired version from the get go:
(change #2.11.0 to the desired version from https://github.com/emberjs/ember.js/releases)
npm uninstall -g ember-cli
npm cache clean
npm install -g ember-cli#2.11.0
Keep the current ember-cli version and then downgrade by changing the ember value in package.json :
(this will work for small version changes, not major changes)
you will need to re init your ember app (change 2.11.0 to what you need from https://github.com/emberjs/ember.js/releases)
rm -rf node_modules dist tmp
npm install --save-dev ember-cli#2.11.0
ember init
Node.js is required with every Ember installation and you have to check which version of node is required for the desired version of Ember you want to install. Most likely itll work well with the version currently installed.
you can download the latest (LTS) from: https://nodejs.org/en/
or older versions from: https://nodejs.org/dist/
OSx for example https://nodejs.org/dist/v4.7.0/node-v4.7.0-linux-x64.tar.gz
results

Uncaught Error: Could not find module `ember-qunit`. Odd out-of-the-box ember-cli behavior

I believe I may have an environment issue here, but I'm quite stuck as to what I can to do resolve it. I created an ember-cli project, committed it to git, added a few things. I ran the typical npm install && bower install commands and tried ember s.
Although the site loads fine, when I browsed to the http://localhost:4200/tests/ to ensure qunit was up and running, I had a few errors.
Uncaught Error: Could not find module `ember-qunit` imported from `ember-project/tests/test-helper
Uncaught Error: Assertion Failed: The tests file was not loaded. Make sure your tests index.html includes "assets/tests.js".
Immediately this raised a red flag, as I have created several ember projects before and not run into similar issues. I had my partners (I'm in school) checkout the project, run the npm install && bower install && ember s and the qunit module worked fine for them!
I've tried to git clone a new repo several times, I've even went so far as to uninstall node and bower completely, but no matter what I try I cannot seem to pull up a normal /tests checkout.
My partners were both running VMs - Ubuntu and Debian, while I'm on a mac, but that seems like it shouldn't be too big of an issue, especially since I created the project!
I've looked several places for this (here, here, and here), but I cannot seem to come to a conclusion which works for me.
I do have an identical bower.json as the rest of my group. I've included the picture below of my file structure, my bower.json, and my tests/index.html.
screenshot
Here are some environment stats:
ember version: 1.13.13
node: 5.0.0
os: darwin x64
bower: 1.7.1
One thing that I did notice is a difference when I do this to see npm's version, but I'm not sure if that matters or not.
ember -v
npm: 2.14.10
npm -v
npm: 3.5.2
It appears to be a regression from the work in ember-cli beta. You can track the progress here https://github.com/ember-cli/ember-cli/issues/5411.
For now, you can add
app.import('bower_components/qunit/qunit/qunit.js');
app.import('bower_components/ember-qunit/ember-qunit.amd.js');
to ember-cli-build.js as a workaround.

How do you import a newly created ember addon?

I'm trying to create my first Ember AddOn and I'm getting stuck importing it into an Ember project. I've created the addon and published to github like this:
ember-cli$ ember addon test-addon
ember-cli$ cd test-addon
ember-cli/test-addon$ git remote add origin <github-url>
Then, from my project, I install the addon:
test-app$ ember install <github-url>
And, lastly, try to import it into a route:
# app/rotues/index.coffee
import TestAddon from 'test-addon'
But, I'm getting this error on the console:
Uncaught Error: Could not find module `test-addon` imported from `test-app/routes/index`
Any ideas where I'm going wrong? I can see the addon in the node_modules directory but not in bower_components. I think(tm) this is my issue but I'm not sure what else I need to do to setup my addon.
tl;dr
cd my-addon
npm link
cd /my/project/dir
npm link my-addon
ember g my-addon # run default blueprint
Then add "my-addon": "*" to the devDependencies section of your app's package.json and restart the ember-cli app server.
Longer Answer
The easiest way to include a locally-developed addon is to use NPM's link
First run npm link from the root of your addon project to register it with npm. Then running npm link <your-addon-name> will have the same effect as npm installing it.
You'll still need to manually add it to your package.json (required for ember-cli to find it when compiling your app) and run the default blueprint (if your addon has one).
If this doesn't seem to be working, check that you've created a package.json in your addon with "ember-addon" in the keywords list (the default ember-cli addon blueprint should do this for you).

Is the ember cli addon installation broken in Ember Cli 0.1.11?

I'm using ember cli for some small test projects to evaluate the concepts. Normal use of ember cli works for me. After 10 created small projects and using blueprints and the pod structure I decided to try the development and usage of addons. The creation of addons was not the real problem.
The problem is I can not successfully install a created addon. I also tried to install other addons created by other ember-cli users. The result is always the same. I got no error message and the addon could be found inside the node_modules directory of the addon consuming application but there is nothing installed in the app directory and it's sub directories !!!
What can I do to find the problem ?
Do you have a public available addon which could be installed definitely without problems ?
Are there log files which could be inspected to see more details (hidden error messages) ?
Best regads
Andreas
The current Ember CLI version is 0.0.12. I'm not aware of any issues with addon installations. If the issue persist, you should create an issue on ember-cli issue tracker.