Skip to content
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

Problems installing 0.12.x with handlebars templates #3232

Closed
yankeeinlondon opened this issue Sep 14, 2015 · 6 comments
Closed

Problems installing 0.12.x with handlebars templates #3232

yankeeinlondon opened this issue Sep 14, 2015 · 6 comments
Labels
npm install issue An issue running `npm install`, whether that's inside of a Sails app, or with `npm install sails -g`

Comments

@yankeeinlondon
Copy link

I am new to sails and so I started by installing 0.11.1 with handlebars as the templating engine:

 npm install -g [email protected]
 npm install -g sails-generate-views-handlebars
 # create repo
 sails new sailor --template=handlebars
 npm install --save handlebars
 npm install --save consolidate

Worked like a charm but then I realised that the hook for Swagger only worked with 0.12 and possibly only with the code on master. So I then preceeded to walk a little closer to the bleeding edge with:

npm uninstall -g sails
npm install -g git://github.com/balderdashy/sails
# ...

This didn't go so well. Tons of errors on the install. Here's a small clipping:

In file included from ../src/bufferutil.cc:16:
../node_modules/nan/nan.h:261:25: error: redefinition of '_NanEnsureLocal'
NAN_INLINE v8::Local _NanEnsureLocal(v8::Local val) {
^
../node_modules/nan/nan.h:256:25: note: previous definition is here
NAN_INLINE v8::Local _NanEnsureLocal(v8::Handle val) {
^
../node_modules/nan/nan.h:661:13: error: no member named 'smalloc' in namespace 'node'
, node::smalloc::FreeCallback callback
~~~~~~^
../node_modules/nan/nan.h:672:12: error: no matching function for call to 'New'
return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
^~~~~~~~~~~~~~~~~
/Users/Ken/.node-gyp/4.0.0/include/node/node_buffer.h:31:40: note: candidate function not viable: no known conversion from 'uint32_t' (aka 'unsigned int') to 'enum encoding' for 3rd argument
NODE_EXTERN v8::MaybeLocalv8::Object New(v8::Isolate* isolate,

If I had to guess it may have something to do with me using node 4.0.0 but this did work just fine with Sails 0.11.1. After a cascade of errors, however, it does install. I then create two new projects:

sails new foo
sails new bar --template=handlebars

Lifting foo appears to work (in this bare bones example) but lifting bar gives the following error:

info: Could not find module: handlebars in path: /path/to/repo/mine/bar/node_modules
/usr/local/lib/node_modules/sails/node_modules/express-handlebars/lib/express-handlebars.js:38
if (this.extname.charAt(0) !== '.') {

TypeError: Cannot read property 'charAt' of undefined
at new ExpressHandlebars (/usr/local/lib/node_modules/sails/node_modules/express-handlebars/lib/express-handlebars.js:38:21)
at Function.create (/usr/local/lib/node_modules/sails/node_modules/express-handlebars/index.js:22:12)
at layoutshim (/usr/local/lib/node_modules/sails/lib/hooks/views/layoutshim.js:36:26)
at Hook.initialize (/usr/local/lib/node_modules/sails/lib/hooks/views/index.js:62:7)
at Hook.bound as initialize
at /usr/local/lib/node_modules/sails/lib/hooks/index.js:75:14
at /usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:451:17
at /usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:441:17
at _each (/usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:46:13)
at Immediate.taskComplete (/usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:440:13)
at processImmediate as _immediateCallback

@yankeeinlondon
Copy link
Author

Note: on reinstalling 0.11.1 I realise that the compilation errors I was referring to were present in this build too. I suspect -- just guessing -- this is node 4.0.0 related but that its ultimately inconsequential. The key difference though is that handlebars based services work in 0.11.x.

@mikermcneil
Copy link
Member

Thanks for the heads up @ksnyde. Just to make sure we're on the same page: the handlebars generators are community-supported features that won't be officially sponsored by development hours from our core team for Sails v1.0 (however runtime support for consolidate-compatible view engines like Handlebars will). We're working on Node 4 support and should have a patch soon :)

@yankeeinlondon
Copy link
Author

Thanks @mikermcneil, sorry for the noob question but are you saying the issue above is likely to be resultant of template generation not doing something correctly (versus a runtime processing issue)? If that's the case, where is the best place for me to submit this type of issue?

@mikermcneil
Copy link
Member

It looks like this is an issue with Node 4 / express-handlebars. Would you try this again with the latest version of Sails?

@sgress454 sgress454 added the npm install issue An issue running `npm install`, whether that's inside of a Sails app, or with `npm install sails -g` label Oct 2, 2015
@tjwebb
Copy link
Contributor

tjwebb commented Oct 25, 2015

@mikermcneil I don't think that a 0.12 series of Sails has been published with the node 4 fixes yet. Has it?

@sailsbot
Copy link

Thanks for posting, @ksnyde. I'm a repo bot-- nice to meet you!

It has been 30 days since there have been any updates or new comments on this page. If this issue has been resolved, feel free to disregard the rest of this message. On the other hand, if you are still waiting on a patch, please:

  • review our contribution guide to make sure this submission meets our criteria (only verified bugs with documented features, please; no questions, commentary, or bug reports about undocumented features or unofficial plugins)
  • create a new issue with the latest information, including updated version details with error messages, failing tests, and a link back to the original issue. This allows GitHub to automatically create a back-reference for future visitors arriving from search engines.

Thanks so much for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
npm install issue An issue running `npm install`, whether that's inside of a Sails app, or with `npm install sails -g`
Development

No branches or pull requests

5 participants