Could not find module ember-validations

我的未来我决定 提交于 2019-12-24 02:23:57

问题


Trying to use ember-validations plugin for ember-cli. Bumped with this issue that I can't figure what is missing.

Here is the dependencies part in my package.json:

"devDependencies": {
    "broccoli-asset-rev": "^2.0.0",
    "broccoli-ember-hbs-template-compiler": "^1.6.1",
    "ember-cli": "0.1.9",
    "ember-cli-6to5": "0.2.1",
    "ember-cli-content-security-policy": "0.3.0",
    "ember-cli-dependency-checker": "0.0.7",
    "ember-cli-ic-ajax": "0.1.1",
    "ember-cli-inject-live-reload": "^1.3.0",
    "ember-cli-qunit": "0.1.2",
    "ember-data": "1.0.0-beta.12",
    "ember-export-application-global": "^1.0.0",
    "express": "^4.8.5",
    "glob": "^4.0.5",
    "ember-validations": "~2.0.0-alpha.2" //Also tried with "~ 2.0.0" as advised in the guide
}

And a simple controller which looks like this:

import Ember from 'ember';
import EmberValidations from 'ember-validations';

export default Ember.Controller.extend(EmberValidations.Mixin, {
    actions: {
        //....
    },
    validations: {
        mailid: {
            presence: true
        },
        password: {
            presence: true
        }
    }
});

And the bower.json:

{
  "name": "ahem",
  "dependencies": {
    "handlebars": "~1.3.0",
    "jquery": "^1.11.1",
    "ember": "1.8.1",
    "ember-data": "1.0.0-beta.12",
    "ember-resolver": "~0.1.11",
    "loader.js": "ember-cli/loader.js#1.0.1",
    "ember-cli-shims": "ember-cli/ember-cli-shims#0.0.3",
    "ember-cli-test-loader": "rwjblue/ember-cli-test-loader#0.0.4",
    "ember-load-initializers": "ember-cli/ember-load-initializers#0.0.2",
    "ember-qunit": "0.1.8",
    "ember-qunit-notifications": "0.0.5",
    "qunit": "~1.17.1",
    "bootstrap": "~3.3.2"
  }
}

But looking the route in the browser gets an error message in the console:

Could not find module ember-validations

Not sure what I'm doing wrong. Any help appreciated.


回答1:


The package seems to be looking for a module called ember-easyform-cli. Thus, I suggest adding:

ember-easyform-cli": "git://github.com/kristianmandrup/ember-easyform-cli.git#master" 

to the package.json file.

Also, I noticed that there are 3 targets ["0.0.0","2.0.0-alpha.1","2.0.0-alpha.2"] available. Try using the 2.0.0-alpha.1 version instead of 2.0.0-alpha.2 by adding "ember-validations": "2.0.0-alpha.1" into the package.json.




回答2:


I had the same issue after installing https://github.com/abpetkov/switchery and importing it via brocfile:

app.import('bower_components/switchery/switchery.js');

switching it to the dist version solved it for me

app.import('bower_components/switchery/dist/switchery.js');

It might be possible there's some kind of conflict between ember-validations and other ember modules. Perhaps revise your Brocfile or package.json and find the source of the issue by trial and error or temporarily disable the packages you recently installed.



来源:https://stackoverflow.com/questions/28175757/could-not-find-module-ember-validations

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!