dimanche 3 septembre 2017

Ember could not find module 'mysql' in components directory

I lately started experiencing this issue where I can not import the 'mysql' module in my component.js

export default Component.extend({
    actions: {
        createPost: function (newPost) {
            var mysql      = require('mysql');
        }
    }
};

This code is followed by this error:

There was an error running your app in fastboot. More info about the error: 
 Error: Could not find module `mysql` imported from `dummy/components/create-new-post/component`

So the file is present in api-directory/tests/dummy/app/components/create-new-post/component.js

However, I have such function present in: api-directory/server/mocks/posts.js and it seems to be working fine there when I use the same 'var mysql = require('mysql');'

I simply cannot get my head over this issue and surfed everywhere for a solution. Can anyone please assist and enlighten me on this most possibly easy solution? Thanks.




Aucun commentaire:

Enregistrer un commentaire