New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Cannot read property 'rootPath' of undefined while using in SailsJS #59
Comments
Can you test 3.9.7 thanks |
@danmademe well, it is still there. To be clear, I don't set any of the config variable at all.
|
It's going to be there because you need to set something to tell express where to look for views. That's what rootdir is. I'll have to debug this myself. There must be somewhere to get a path, or set the path. |
Looks like the views string. |
Hey @danmademe! Anything moved here? |
I think sailsJS supports passing data to the view engine. In the |
Also, does d9cef58 fix this issue? Because I'm on express-vue 3.10.0 but I still got the error, but it appears that commit is included in 3.10.0. |
Looks like that commit didn't fix the issue. This locals object.. I'm going to have to look into that and add it to the model. |
I don't have time to look at this over the weekend. |
No worries - I'll share what I figure out about the render function and locals object when I get to something conclusive. I'm not 100% sure how they interop... but I'm currently trying to use Vue's Server-side rendering so I'm having to learn more about the getRenderFn. |
Guys, consolidate.js is abandoned and will be deprecated in the Sails.js 1.0.0 (commit). @snewell92 you can see how to use express-vue in Sails.js without consolidate.js here. Back to the issue. The problem is that |
I have solved the issue. Here are the steps:
module.exports.http = {
middleware: {
},
customMiddleware: function(app) {
app.set('vue', {
// configure express-vue here
// do not use __dirname here, otherwise the path will look like:
// /Users/username/your-project/config/components
// componentsDir: app.settings.views + '/components',
});
}
}; Now, inside this function you can configure any custom middleware like you do for Express. That's it, problem solved. We can close the issue now. |
thanks heaps @duffpod !!!! i'll add this to the readme.. so you're saying |
@danmademe, Also, I think you should consider adding the section about using your project in Sails.js as someone else is definitely will be asking about it. If you choose to add such section you can use my gist as a base point for yours: https://gist.github.com/duffpod/746a660bcddfd986878c92dde1a04f06. |
@duffpod i've added your gist into the readme.. i'll look into the app.settings.views.. but ultimately this project is an integration between express .. and vue.. sailsjs seems to be a whole other beast. but I'll look into support for it, due to lots of people wanting to use it. |
@danmademe, sure I understand that your library is intended for Express.js, but Sails.js is fully based on Express.js and their team states that Sails.js has nearly full compatibility with Express's middleware. Anyway, thank you for your hard work with this library. |
…ad_with_rel added support for rel tags
Description of Issue
I know, this lib is for Express, but I am trying to make it work in the Sails framework.
Stack Trace / Console Log
Additional Comments
Tracked the error to the file at
dist/models/defaults.js
. Fixed by supplying the empty objects while pre-validating theoptions
variable.From this:
To this:
The text was updated successfully, but these errors were encountered: