Created
September 5, 2011 03:37
-
-
Save TooTallNate/1194032 to your computer and use it in GitHub Desktop.
Creating a Cocoa GUI window with NodObjC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var $ = require('./') | |
$.import('Foundation') | |
$.import('Cocoa') | |
var pool = $.NSAutoreleasePool('alloc')('init') | |
var app = $.NSApplication('sharedApplication') | |
var style = $.NSClosableWindowMask | $.NSResizableWindowMask | |
| $.NSTexturedBackgroundWindowMask | $.NSTitledWindowMask | |
| $.NSMiniaturizableWindowMask | |
var rect = $.NSMakeRect(50, 50, 600, 400) | |
var win = $.NSWindow('alloc')('initWithContentRect', rect | |
, 'styleMask', style | |
, 'backing', $.NSBackingStoreBuffered | |
, 'defer', 0) | |
win('makeKeyAndOrderFront', win) | |
app('run') | |
pool('release') |
Seemed to install ok after using "sudo npm install NodObjC"
bash-3.2$ npm install NodObjC
npm info it worked if it ends with ok
npm info using ***@***.***
npm info using ***@***.***
npm info fetch http://registry.npmjs.org/NodObjC/-/NodObjC-0.0.7.tgz
npm info calculating sha1
/var/folders/1w/1wE-WlatGJGQ-s6Iz9j5-E+++TI/-Tmp-/npm-1316121131114/1316121131114-0.8157159895636141/tmp.tgz
npm info shasum 4db3a1fbfba47e95dc08a0933d7abdb8b59ec536
npm ERR! Could not create
/usr/local/lib/node/.npm/.cache/NodObjC/0.0.7/package.tgz
npm ERR! Failed creating the tarball.
npm ERR! couldn't pack
/var/folders/1w/1wE-WlatGJGQ-s6Iz9j5-E+++TI/-Tmp-/npm-1316121131114/1316121131114-0.8157159895636141/contents/package
to /usr/local/lib/node/.npm/.cache/NodObjC/0.0.7/package.tgz
npm ERR! Error installing ***@***.***
npm ERR! Error: EACCES, Permission denied '/usr/local/lib/node/.npm'
npm ERR!
npm ERR! Please use 'sudo' or log in as root to run this command.
npm ERR!
npm ERR! sudo npm "install" "NodObjC"
npm ERR!
npm ERR! or set the 'unsafe-perm' config var to true.
npm ERR!
npm ERR! npm config set unsafe-perm true
npm ERR! System Darwin 10.6.0
npm ERR! argv { remain: [ 'NodObjC' ],
npm ERR! argv cooked: [ 'install', 'NodObjC' ],
npm ERR! argv original: [ 'install', 'NodObjC' ] }
npm not ok
bash-3.2$ sudo npm install NodObjC
npm info it worked if it ends with ok
npm info using ***@***.***
npm info using ***@***.***
npm info fetch http://registry.npmjs.org/NodObjC/-/NodObjC-0.0.7.tgz
npm info calculating sha1
/tmp/npm-1316121140088/1316121140088-0.47182347741909325/tmp.tgz
npm info shasum 4db3a1fbfba47e95dc08a0933d7abdb8b59ec536
npm WARN publish-everything ***@***.*** Adding entire directory to
tarball. Please add a
npm WARN publish-everything ***@***.*** .npmignore or specify a 'files'
array in the package.json
npm info calculating sha1
/usr/local/lib/node/.npm/.cache/NodObjC/0.0.7/package.tgz
npm info shasum 5824d5fd02fba13f7f1fdf3b953d5b6fd32af41f
npm info range ***@***.***
npm info fetch http://registry.npmjs.org/sax/-/sax-0.1.5.tgz
npm info calculating sha1
/tmp/npm-1316121140088/1316121145955-0.909670484950766/tmp.tgz
npm info shasum d1829a6120fa01665eb4dbff6c43f29fd6d61471
npm WARN publish-everything ***@***.*** Adding entire directory to tarball.
Please add a
npm WARN publish-everything ***@***.*** .npmignore or specify a 'files'
array in the package.json
npm info calculating sha1
/usr/local/lib/node/.npm/.cache/sax/0.1.5/package.tgz
npm info shasum 429f209fafdd9c2268c29bcf94ba4d205a2c7590
npm info preinstall ***@***.***
npm info preinstall ***@***.***
npm info install ***@***.***
npm info postinstall ***@***.***
npm info preactivate ***@***.***
npm info activate ***@***.***
npm info postactivate ***@***.***
npm info install ***@***.***
npm info postinstall ***@***.***
npm info preactivate ***@***.***
npm info activate ***@***.***
npm info postactivate ***@***.***
npm info build Success: ***@***.***
npm info build Success: ***@***.***
npm ok
bash-3.2$
but still get exactly the same error with hello world and cocoa gui
…On Thu, Sep 15, 2011 at 11:59 PM, Nathan Rajlich < ***@***.***>wrote:
Oh I see what's going on. You're on ***@***.***`. That version doesn't
have a lot of the good stuff. I just published `v0.0.7` which gives support
back for node 0.4.x. So re-run `npm install NodObjC` and let me know how it
goes.
##
Reply to this email directly or view it on GitHub:
https://gist.github.com/1194032
@billymoon Come to IRC room #nodobjc
on Freenode and I can help walk you through it.
I just got it working - was a problem with my node installation (
http://stackoverflow.com/questions/7437447/how-to-build-and-install-node-js-on-osx-from-git-clone/7438098#7438098)
which I solved by completely removing it, the re-installing everything.
After that - I had to install NodObjC twice (once before all the other
modules like express etc...) - both times with success message, then it all
works fine. Hello world and cocoa.
Happy days.
Thanks a bunch for your help. This is a very exciting project. Javascript is
appearing everywhere now - I really like it.
Cheers
Billy
…On Fri, Sep 16, 2011 at 12:59 AM, Nathan Rajlich < ***@***.***>wrote:
@billymoon Come to IRC room `#nodobjc` on Freenode and I can help walk you
through it.
##
Reply to this email directly or view it on GitHub:
https://gist.github.com/1194032
Well glad you got it figured out :)
On Thu, Sep 15, 2011 at 3:34 PM, billymoon <
[email protected]>wrote:
… I just got it working - was a problem with my node installation (
http://stackoverflow.com/questions/7437447/how-to-build-and-install-node-js-on-osx-from-git-clone/7438098#7438098
)
which I solved by completely removing it, the re-installing everything.
After that - I had to install NodObjC twice (once before all the other
modules like express etc...) - both times with success message, then it all
works fine. Hello world and cocoa.
Happy days.
Thanks a bunch for your help. This is a very exciting project. Javascript
is
appearing everywhere now - I really like it.
Cheers
Billy
On Fri, Sep 16, 2011 at 12:59 AM, Nathan Rajlich <
***@***.***>wrote:
> @billymoon Come to IRC room `#nodobjc` on Freenode and I can help walk
> you
> through it.
> ##
>
> Reply to this email directly or view it on GitHub:
> https://gist.github.com/1194032
##
Reply to this email directly or view it on GitHub:
https://gist.github.com/1194032
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Oh I see what's going on. You're on
[email protected]
. That version doesn't have a lot of the good stuff. I just publishedv0.0.7
which gives support back for node 0.4.x. So re-runnpm install NodObjC
and let me know how it goes.