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

Weird Error on Boilerplate #101

Closed
krrishd opened this issue Sep 26, 2013 · 24 comments
Closed

Weird Error on Boilerplate #101

krrishd opened this issue Sep 26, 2013 · 24 comments

Comments

@krrishd
Copy link

krrishd commented Sep 26, 2013

I just installed a boilerplate for Harp, but when I run the server, this is what I get:

TypeError
Property 'hasOwnProperty' of object # is not a function
Your Harp app could not be built because of a TypeError in

    1| TypeError: Property 'hasOwnProperty' of object #<Object> is not a function
    2|     at isEmpty (/usr/lib/node_modules/harp/node_modules/terraform/lib/helpers/raw.js:172:12)
    3|     at /usr/lib/node_modules/harp/node_modules/terraform/lib/helpers/raw.js:248:13
    4|     at Array.forEach (native)
    5|     at exports.dataTree (/usr/lib/node_modules/harp/node_modules/terraform/lib/helpers/raw.js:241:8)
    6|     at /usr/lib/node_modules/harp/node_modules/terraform/lib/helpers/raw.js:247:17
    7|     at Array.forEach (native)
    8|     at exports.dataTree (/usr/lib/node_modules/harp/node_modules/terraform/lib/helpers/raw.js:241:8)
    9|     at /usr/lib/node_modules/harp/node_modules/terraform/lib/helpers/raw.js:247:17
   10|     at Array.forEach (native)
   11|     at exports.dataTree (/usr/lib/node_modules/harp/node_modules/terraform/lib/helpers/raw.js:241:8)
   12|     at /usr/lib/node_modules/harp/node_modules/terraform/lib/helpers/raw.js:247:17
   13|     at Array.forEach (native)
   14|     at exports.dataTree (/usr/lib/node_modules/harp/node_modules/terraform/lib/helpers/raw.js:241:8)
   15|     at /usr/lib/node_modules/harp/node_modules/terraform/lib/helpers/raw.js:247:17
   16|     at Array.forEach (native)
   17|     at exports.dataTree (/usr/lib/node_modules/harp/node_modules/terraform/lib/helpers/raw.js:241:8)
   18|     at /usr/lib/node_modules/harp/node_modules/terraform/lib/helpers/raw.js:247:17
   19|     at Array.forEach (native)
   20|     at exports.dataTree (/usr/lib/node_modules/harp/node_modules/terraform/lib/helpers/raw.js:241:8)
   21|     at /usr/lib/node_modules/harp/node_modules/terraform/lib/helpers/raw.js:247:17
   22|     at Array.forEach (native)
   23|     at Object.exports.dataTree (/usr/lib/node_modules/harp/node_modules/terraform/lib/helpers/raw.js:241:8)
   24|     at Object.exports.root (/usr/lib/node_modules/harp/node_modules/terraform/lib/terraform.js:37:25)
   25|     at Object.exports.poly [as handle] (/usr/lib/node_modules/harp/lib/middleware.js:210:24)
   26|     at next (/usr/lib/node_modules/harp/node_modules/connect/lib/proto.js:190:15)
   27|     at resume (/usr/lib/node_modules/harp/lib/middleware.js:142:5)
   28|     at SendStream.error (/usr/lib/node_modules/harp/lib/middleware.js:159:11)
   29|     at SendStream.EventEmitter.emit (events.js:95:17)
   30|     at SendStream.error (/usr/lib/node_modules/harp/node_modules/connect/node_modules/send/lib/send.js:147:51)
   31|     at SendStream.onStatError (/usr/lib/node_modules/harp/node_modules/connect/node_modules/send/lib/send.js:248:48)
   32|     at /usr/lib/node_modules/harp/node_modules/connect/node_modules/send/lib/send.js:320:26
   33|     at Object.oncomplete (fs.js:107:15)

@kennethormandy
Copy link
Collaborator

Hey @krrishd,

Which boilerplate did this happen with? This was the error as soon as you ran harp server?

@krrishd
Copy link
Author

krrishd commented Sep 27, 2013

All I did was:

harp init .

harp server

[image: 3sparks llc] http://htmlsig.com/ClassifyStudios.com

Krish Dholakiya / Lead Developer/Designer
krish.dholakiya@classifystudios.com

Classify Studios
ClassifyStudios.com http://htmlsig.com/ClassifyStudios.com

[image: Linkedin] http://linkedin.com/in/krishdholakiya

This e-mail message may contain confidential or legally privileged
information and is intended only for the use of the intended recipient(s).
Any unauthorized disclosure, dissemination, distribution, copying or the
taking of any action in reliance on the information herein is prohibited.
E-mails are not secure and cannot be guaranteed to be error free as they
can be intercepted, amended, or contain viruses. Anyone who communicates
with us by e-mail is deemed to have accepted these risks. Classify Studios
is not responsible for errors or omissions in this message and denies any
responsibility for any damage arising from the use of e-mail. Any opinion
and other statement contained in this message and any attachment are solely
those of the author and do not necessarily represent those of Classify
Studios.

On Thu, Sep 26, 2013 at 9:20 PM, Kenneth Ormandy
notifications@github.comwrote:

Hey @krrishd https://github.com/krrishd,

Which boilerplate did this happen with? This was the error as soon as you
ran harp server?


Reply to this email directly or view it on GitHubhttps://github.com//issues/101#issuecomment-25219914
.

@kennethormandy
Copy link
Collaborator

Hm, that definitely shouldn’t happen. Were there other things in the folder already, or no? And would you mind telling me what version of Harp you’re using?

@alexandrosm
Copy link

Just got the same problem with a .less file. The client requests a file called main.css. The folder had a file called main.less. If I understand correctly, harp should return the compiled file. Instead I get

TypeError
Property 'hasOwnProperty' of object #<Object> is not a function
Your Harp app could not be built because of a TypeError in
    1| TypeError: Property 'hasOwnProperty' of object #<Object> is not a function
    2|     at isEmpty (C:\Users\Alexandros\AppData\Roaming\npm\node_modules\harp\node_modules\terraform\lib\helpers\raw.js:172:12)
    3|     at C:\Users\Alexandros\AppData\Roaming\npm\node_modules\harp\node_modules\terraform\lib\helpers\raw.js:248:13
    4|     at Array.forEach (native)
    5|     at exports.dataTree (C:\Users\Alexandros\AppData\Roaming\npm\node_modules\harp\node_modules\terraform\lib\helpers\raw.js:241:8)
    6|     at C:\Users\Alexandros\AppData\Roaming\npm\node_modules\harp\node_modules\terraform\lib\helpers\raw.js:247:17
    7|     at Array.forEach (native)
    8|     at exports.dataTree (C:\Users\Alexandros\AppData\Roaming\npm\node_modules\harp\node_modules\terraform\lib\helpers\raw.js:241:8)
    9|     at C:\Users\Alexandros\AppData\Roaming\npm\node_modules\harp\node_modules\terraform\lib\helpers\raw.js:247:17
   10|     at Array.forEach (native)
   11|     at exports.dataTree (C:\Users\Alexandros\AppData\Roaming\npm\node_modules\harp\node_modules\terraform\lib\helpers\raw.js:241:8)
   12|     at C:\Users\Alexandros\AppData\Roaming\npm\node_modules\harp\node_modules\terraform\lib\helpers\raw.js:247:17
   13|     at Array.forEach (native)
   14|     at Object.exports.dataTree (C:\Users\Alexandros\AppData\Roaming\npm\node_modules\harp\node_modules\terraform\lib\helpers\raw.js:241:8)
   15|     at Object.exports.root (C:\Users\Alexandros\AppData\Roaming\npm\node_modules\harp\node_modules\terraform\lib\terraform.js:37:25)
   16|     at Object.exports.poly [as handle] (C:\Users\Alexandros\AppData\Roaming\npm\node_modules\harp\lib\middleware.js:210:24)
   17|     at next (C:\Users\Alexandros\AppData\Roaming\npm\node_modules\harp\node_modules\connect\lib\proto.js:190:15)
   18|     at resume (C:\Users\Alexandros\AppData\Roaming\npm\node_modules\harp\lib\middleware.js:142:5)
   19|     at SendStream.error (C:\Users\Alexandros\AppData\Roaming\npm\node_modules\harp\lib\middleware.js:159:11)
   20|     at SendStream.EventEmitter.emit (events.js:95:17)
   21|     at SendStream.error (C:\Users\Alexandros\AppData\Roaming\npm\node_modules\harp\node_modules\connect\node_modules\send\lib\send.js:147:51)
   22|     at SendStream.onStatError (C:\Users\Alexandros\AppData\Roaming\npm\node_modules\harp\node_modules\connect\node_modules\send\lib\send.js:248:48)
   23|     at C:\Users\Alexandros\AppData\Roaming\npm\node_modules\harp\node_modules\connect\node_modules\send\lib\send.js:320:26
   24|     at Object.oncomplete (fs.js:107:15)

@kennethormandy
Copy link
Collaborator

@alexandrosm Hey, thanks very much for commenting on this issue. You are correct, Harp should return the .css file in that situation. I wasn’t able to recreate the problem myself, but I think I know what it is now. It looks like you’re on Windows, right? But @krrishd isn’t?

@alexandrosm
Copy link

Yes, Windows 7.

Did some sleuthing and modified isEmpty in terraform/lib/helpers/raw.js to be as follows:

var isEmpty = function(obj) {
  for(var prop in obj) {
    if(Object.prototype.hasOwnProperty.call(obj,prop))
      return false;
  }
  return true;
}

With that in place (which should give an identical result IIUC), I now get the following error instead:

localhost:9000
Page Not Found
404.jade
404 File Not Found
We strongly recommend you add a 404.jade file to your project.

Not sure if this helps at all. Let me know if there is anything else I can do to help.

@kennethormandy
Copy link
Collaborator

Thanks for doing that! Definitely helpful. It looks like it’s this problem, where certain preprocessed files aren’t getting served up properly on Windows.

@alexandrosm
Copy link

I see, this problem seems to have been known for months. Any idea if it's getting solved soon? I was hoping to start on a grunt-harp plugin tonight, but not really looking feasible now.

@kennethormandy
Copy link
Collaborator

That was my mistake actually, I reopened an issue when I probably should have made a new one. That’s just where my testing comment happened to be. If you rename main.less to main.css, it should appear as expected right now, but obviously this is not ideal.

I can’t commit to a timeframe since I don’t have the skill to fix it, but I will try and make it a priority. I am being a pest about it right now. The details you’re providing are all helpful, so thank you.

@alexandrosm
Copy link

Thanks a lot. Keep pestering :).

Let me know if there is anything I can do to help. Harp is a great project and when it's fixed I'm hoping to use it to radically simplify yeoman's development workflow.

@andyshinn
Copy link

I'm running into the same error on Mac OS X Mountain Lion when trying out harp in my own project (jade). However, the boilerplate does work. I tried with v0.9.3 and master. Running node v0.10.13 and npm 1.3.2.

@kennethormandy
Copy link
Collaborator

Thanks @andyshinn. If it is the exact same error message, I think sintaxi/terraform@1589aad should fix it in Harp v0.9.4. If you’d like to share what you’re working on, we can check or try and help debug it further.

@kennethormandy
Copy link
Collaborator

Hey @alexandrosm. As of v0.9.4, Harp now supports Windows! If you have a moment to try it out, please let us know how it goes.

@andyshinn & @krrishd, if you happen to have a moment to see if you’re still having this problem on OS X, that’d be great. We’d definitely like to help you debug it, but we might need some more information about the respective apps your working on. Thanks!

@alexandrosm
Copy link

Thanks for all the hard work and patience guys.. however..

I am still seeing the problem I had, where a requesting e.g. app.js in a route where app.coffee exists returns a Page Not Found error.

image

Any thoughts? I uninstalled and reinstalled harp -g but still no light.

@kennethormandy
Copy link
Collaborator

Thanks very much for trying it out. Just as a quick test, on Windows I created a basic app and with an src folder and an app.coffee file, and it was compiled successfully at the URL you’re on, so that’s promising at least. Any chance you’d be able to share your specific app so we can try and get to the bottom of this?

@alexandrosm
Copy link

This is interesting.. I created a minimal app with simply a src directory and an app.coffee file in it, and I get a different error message:

image

Will try to run on a simpler path and see if that does anything. cheers.

@alexandrosm
Copy link

Tried a simple 'harptest' directory on c:\ , added an app.coffee file on it. asking for app.js file on it still shows the Page Not Found / 404.jade error.

@alexandrosm
Copy link

Confirmed the same issue for main.css (which should be getting converted from main.less). Also, I now consistently get the second error message everywhere (the one pointing to 404.jade missing).

It's not to do with my code, though it may be to do with my setup somehow. Don't have another windows machine to test right now, perhaps @Page- can give it a shot?

@kennethormandy
Copy link
Collaborator

I followed the same steps as you on a Windows 7 virtual machine and it worked as I would have expected, so that bodes well for getting this fixed. But I’m not totally sure how to go about debugging it, it sounds like you’re doing everything right. If you wanted, you could clone Harp locally and run the tests, but I’m not sure if that would reveal any discrepancies or not. Do you know what version of Node.js you’re using?

@alexandrosm
Copy link

Ok, so I needed an npm cache clean before installing. Now the conversion works just fine.

It is taking 5-6 sec. to compile a very simple coffeescript file though. Is this time normal? Is there any caching built-in?

Thanks for the hard work @sintaxi and the infinite patience @kennethormandy

@alexandrosm
Copy link

to illustrate the above:

image

@kennethormandy
Copy link
Collaborator

I’m glad it’s working, I ruled out it being an npm caching thing since you had the v0.9.4 error page, that’s strange it can work like that.

We have had this come up before, there’s an open pull request for CoffeeScript caching. I don’t know the intricacies of this, but I think caching kind of conflicts with how Harp needs to work. But if you wouldn’t mind opening a new issue for it, that’d be awesome.

@andyshinn
Copy link

FWIW, the same error the OP reported (and I was getting) is now gone and it appears to be properly compiling my Jade templates now. The page doesn't display. But that is likely because of minification / Require.js issues. I'll be keeping my eyes on #54, #55, and #71 😄

@kennethormandy
Copy link
Collaborator

Thanks @andyshinn, if it turns out there is still a problem, please let us know about it and we’ll do what we can. Getting your thoughts #55 especially would be great.

I’m going to close this one now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants