hoodiehq-archive / local-tld

Maintain a TLD on localhost for all your projects
199 stars 20 forks source link

installing local-tld via npm as sudo gives errors #10

Closed nborwankar closed 11 years ago

nborwankar commented 11 years ago

ends up in a prompt that asks for my sudo passwd but doesn't recognize it.

All other sudo commands work and my passwd works on those

Even when I have just used sudo a few seconds before on another command which worked I still get asked for my passwd and it fails.

i.e. the issue is not with my passwd it seems to be with the local-tld install script.

==== long - see transcript below

npm install -g local-tld
npm http GET https://registry.npmjs.org/local-tld
npm http 304 https://registry.npmjs.org/local-tld

> local-tld@3.0.2 preuninstall /usr/local/lib/node_modules/local-tld
> ./bin/local-tld-uninstall

+ sudo launchctl unload /Library/LaunchDaemons/ie.hood.local-tld-firewall.plist
Password:
+ launchctl unload /Users/nitin/Library/LaunchAgents/ie.hood.local-tld-service.plist
+ sudo rm -f /Library/LaunchDaemons/ie.hood.local-tld-firewall.plist
+ rm -f /Users/nitin/Library/LaunchAgents/ie.hood.local-tld-service.plist
+ sudo rm -f /etc/resolver/dev

> local-tld@3.0.2 preuninstall /usr/local/lib/node_modules/local-tld
> ./bin/local-tld-uninstall

+ sudo launchctl unload /Library/LaunchDaemons/ie.hood.local-tld-firewall.plist
launchctl: Couldn't stat("/Library/LaunchDaemons/ie.hood.local-tld-firewall.plist"): No such file or directory
nothing found to unload
npm WARN continuing anyway local-tld@3.0.2 preuninstall: `./bin/local-tld-uninstall`
npm WARN continuing anyway `sh "-c" "./bin/local-tld-uninstall"` failed with 1
npm ERR! error rolling back Error: EACCES, unlink '/usr/local/lib/node_modules/local-tld/.npmignore'
npm ERR! error rolling back  local-tld@3.0.2 { [Error: EACCES, unlink '/usr/local/lib/node_modules/local-tld/.npmignore']
npm ERR! error rolling back   errno: 3,
npm ERR! error rolling back   code: 'EACCES',
npm ERR! error rolling back   path: '/usr/local/lib/node_modules/local-tld/.npmignore' }
npm ERR! Error: EACCES, unlink '/usr/local/lib/node_modules/local-tld/.npmignore'
npm ERR!  { [Error: EACCES, unlink '/usr/local/lib/node_modules/local-tld/.npmignore']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/usr/local/lib/node_modules/local-tld/.npmignore' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Darwin 11.4.2
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "local-tld"
npm ERR! cwd /Users/nitin
npm ERR! node -v v0.10.3
npm ERR! npm -v 1.2.17
npm ERR! path /usr/local/lib/node_modules/local-tld/.npmignore
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, unlink '/usr/local/lib/node_modules/local-tld/.npmignore'
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/nitin/npm-debug.log
npm ERR! not ok code 0
[00:58][nitin@nitinmacbookpro:~]$ sudo npm install -g local-tld
npm http GET https://registry.npmjs.org/local-tld
npm http 304 https://registry.npmjs.org/local-tld

> local-tld@3.0.2 preuninstall /usr/local/lib/node_modules/local-tld
> ./bin/local-tld-uninstall

+ sudo launchctl unload /Library/LaunchDaemons/ie.hood.local-tld-firewall.plist

WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.

To proceed, enter your password, or type Ctrl-C to abort.

Password:
Sorry, try again.
Password:
Sorry, try again.
Password:
sudo: 2 incorrect password attempts

actually I went to 3 more than once no difference

jbolila commented 11 years ago

I had an identical problem, that stopped happening when I went from the iTerm to Terminal, see this from homebrew wiki.

janl commented 11 years ago

wow, that is crazy obscure!

nborwankar commented 11 years ago

I am using Terminal not iTerm all along. Nitin

Nitin Borwankar nborwankar@gmail.com On Apr 9, 2013 3:12 AM, "João Bolila" notifications@github.com wrote:

I had an identical problem, that stopped happening when I went from the iTerm to Terminal, see thishttps://github.com/mxcl/homebrew/wiki/Common-Issues#launchctl-refuses-to-load-launchd-plist-filesfrom homebrew wiki.

— Reply to this email directly or view it on GitHubhttps://github.com/hoodiehq/local-tld/issues/10#issuecomment-16104548 .

nborwankar commented 11 years ago

Also the errorb shown on brew wiki doesn't apply to me. I have a sudo issue not a socket issue. The second potential cause in the wiki doesn't apply eithe r. Although the problemn does arise during launchctld invocation. Sounds like a permissions issue in my case.

Nitin

Nitin Borwankar nborwankar@gmail.com On Apr 9, 2013 8:18 AM, "Nitin Borwankar" nborwankar@gmail.com wrote:

I am using Terminal not iTerm all along. Nitin

Nitin Borwankar nborwankar@gmail.com On Apr 9, 2013 3:12 AM, "João Bolila" notifications@github.com wrote:

I had an identical problem, that stopped happening when I went from the iTerm to Terminal, see thishttps://github.com/mxcl/homebrew/wiki/Common-Issues#launchctl-refuses-to-load-launchd-plist-filesfrom homebrew wiki.

— Reply to this email directly or view it on GitHubhttps://github.com/hoodiehq/local-tld/issues/10#issuecomment-16104548 .

bbn commented 11 years ago

Exact same sudo problem for me. In case it's helpful, here's the npm install log: https://gist.github.com/bbn/5347136

nborwankar commented 11 years ago

Is this an OS Version issue?

Can Hoodie developers say on home page what OSX version including minor version, this actually has been tested on. Perhaps only Lion has been tested? I am on Snow Leopard. Also versions of Ruby, Nodejs, Homebrew. Does it matter if one is using OpenDNS - does this interact badly with the mdns implementation used to create local-tld?

Also just FYI - I have been using MacOSX for about 8 years now and I have never seen sudo behavior like this. Not saying it's necessarily a hoodie issue but it could be a particular combination of some subset of launchctl version, nodejs version, OS version and OpenDNS and ruby version interacting to produce this edge case.

Finally is it OK to install without the -g flag or is global install somehow critical to Hoodie performance?

Nitin


Nitin Borwankar nborwankar@gmail.com

On Tue, Apr 9, 2013 at 9:12 AM, Ben Nevile notifications@github.com wrote:

Exact same sudo problem for me.

— Reply to this email directly or view it on GitHubhttps://github.com/hoodiehq/local-tld/issues/10#issuecomment-16122815 .

janl commented 11 years ago

@bbn it looks like you are on Mountain Lion (Like I am), is that correct?

janl commented 11 years ago

Is this an OS Version issue?

Maybe :)

Can Hoodie developers say on home page what OSX version including minor version, this actually has been tested on. Perhaps only Lion has been tested? I am on Snow Leopard.

I know we did have issues on a Snow Leopard once, but I believe we fixed them, but the developer moved to Mountain Lion now, and I haven’t checked back.

I have a Snow Leopard that I can try this with at some point, but capacity at this very moment, so for now, yes, assume Latest Mac OS X.

Also versions of Ruby, Nodejs, Homebrew.

$ ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
$ brew -v
Homebrew 0.9.4
$ node -v
v0.8.19

Does it matter if one is using OpenDNS

Shouldn’t, but you never know, Mac OS X’s DNS resolution ways are dark and mysterious (and changing between versions a lot).

  • does this interact badly with the mdns implementation used to create local-tld?

There is no mdns in local-tld.

Also just FYI - I have been using MacOSX for about 8 years now and I have never seen sudo behavior like this.

10 years, same here.

Finally is it OK to install without the -g flag or is global install somehow critical to Hoodie performance?

Functionality, not performance. The post-install script of hoodie needs sudo to set up a firewall route to make the magic work. You can manually disable the postinstall and do all the steps by hand, but we made it nice and bundeld for you so you don’t have to fiddle with it in the first place.

janl commented 11 years ago

@nborwankar silly question, but you don’t happen to run into having caps lock set for typing the password that one time or anything?

bbn commented 11 years ago

Yes - most recent OS.

On Tue, Apr 9, 2013 at 6:26 PM, Jan Lehnardt notifications@github.com wrote:

@bbn it looks like you are on Mountain Lion (Like I am), is that correct?

Reply to this email directly or view it on GitHub: https://github.com/hoodiehq/local-tld/issues/10#issuecomment-16144299

janl commented 11 years ago

@bbn excellent, thanks, do you have any other oddities on your system that might help resolve this, because I literally have no fucking clue why this should happen, albeit I admit that what we are doing (sudo in an npm postinstall script is pretty dirty.

janl commented 11 years ago

I just pushed a commit (https://github.com/hoodiehq/local-tld/commit/e5c32331082c24d68039e91b1daaad55bdb12922) and version 3.0.3 to NPM that might solve this. Can you give it a shot?

Note that you are expected to run npm install -g local-tld not sudo npm… If you get permission errors, try starting from scratch by doing sudo npm uninstall -g local-tld.

nborwankar commented 11 years ago

OK - stupid me - I am on Mountain Lion , not Snow Leopard, those two word wild cats confuse me :-)

Other versions

ruby -v ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-darwin11.4.2] $ brew -v Homebrew 0.9.4 $ node -v v0.10.3

Nitin


Nitin Borwankar nborwankar@gmail.com

On Tue, Apr 9, 2013 at 3:32 PM, Jan Lehnardt notifications@github.comwrote:

Is this an OS Version issue?

Maybe :)

Can Hoodie developers say on home page what OSX version including minor version, this actually has been tested on. Perhaps only Lion has been tested? I am on Snow Leopard.

I know we did have issues on a Snow Leopard once, but I believe we fixed them, but the developer moved to Mountain Lion now, and I haven’t checked back.

I have a Snow Leopard that I can try this with at some point, but capacity at this very moment, so for now, yes, assume Latest Mac OS X.

Also versions of Ruby, Nodejs, Homebrew.

$ ruby -v ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0] $ brew -v Homebrew 0.9.4 $ node -v v0.8.19

Does it matter if one is using OpenDNS

Shouldn’t, but you never know, Mac OS X’s DNS resolution ways are dark and mysterious (and changing between versions a lot).

  • does this interact badly with the mdns implementation used to create local-tld?

    There is no mdns in local-tld.

Also just FYI - I have been using MacOSX for about 8 years now and I have never seen sudo behavior like this.

10 years, same here.

Finally is it OK to install without the -g flag or is global install somehow critical to Hoodie performance?

Functionality, not performance. The post-install script of hoodie needs sudo to set up a firewall route to make the magic work. You can manually disable the postinstall and do all the steps by hand, but we made it nice and bundeld for you so you don’t have to fiddle with it in the first place.

— Reply to this email directly or view it on GitHubhttps://github.com/hoodiehq/local-tld/issues/10#issuecomment-16144577 .

janl commented 11 years ago

@nborwankar can you try the latest local-tld 3.0.3 I just pushed: https://github.com/hoodiehq/local-tld/issues/10#issuecomment-16145973

nborwankar commented 11 years ago

Will try again - BTW both those command lines with or without "sudo ..." gave the same behavior eventually. Also I've been away from the node dev world for about a year and ITMW the idiom has changed from "don't use sudo with npm" to "use sudo with npm ". So I have no f'in idea which one is the idiom du jour and in this kind of situation I will try one then the other just for A/B purposes. In this case A=B :-) Nitin


Nitin Borwankar nborwankar@gmail.com

On Tue, Apr 9, 2013 at 4:03 PM, Jan Lehnardt notifications@github.comwrote:

I just pushed a commit (e5c3233https://github.com/hoodiehq/local-tld/commit/e5c32331082c24d68039e91b1daaad55bdb12922) and version 3.0.3 to NPM that might solve this. Can you give it a shot?

Note that you are expected to run npm install -g local-tld not sudo npm…If you get permission errors, try starting from scratch by doing sudo npm uninstall -g local-tld.

— Reply to this email directly or view it on GitHubhttps://github.com/hoodiehq/local-tld/issues/10#issuecomment-16145973 .

nborwankar commented 11 years ago

OK so you want me to do an npm-install from inside the git repo, to get the lates code right?


Nitin Borwankar nborwankar@gmail.com

On Tue, Apr 9, 2013 at 4:19 PM, Jan Lehnardt notifications@github.comwrote:

@nborwankar https://github.com/nborwankar can you try the latest local-tld 3.0.3 I just pushed: #10https://github.com/hoodiehq/local-tld/issues/10#issuecomment-16145973

— Reply to this email directly or view it on GitHubhttps://github.com/hoodiehq/local-tld/issues/10#issuecomment-16146518 .

janl commented 11 years ago

On Apr 10, 2013, at 00:21 , Nitin Borwankar notifications@github.com wrote:

Will try again - BTW both those command lines with or without "sudo ..." gave the same behavior eventually. Also I've been away from the node dev world for about a year and ITMW the idiom has changed from "don't use sudo with npm" to "use sudo with npm ". So I have no f'in idea which one is the idiom du jour and in this kind of situation I will try one then the other just for A/B purposes. In this case A=B :-)

We are doing some crazy things, regardless of the mainline node doctrine :)

Jan

Nitin


Nitin Borwankar nborwankar@gmail.com

On Tue, Apr 9, 2013 at 4:03 PM, Jan Lehnardt notifications@github.comwrote:

I just pushed a commit (e5c3233https://github.com/hoodiehq/local-tld/commit/e5c32331082c24d68039e91b1daaad55bdb12922) and version 3.0.3 to NPM that might solve this. Can you give it a shot?

Note that you are expected to run npm install -g local-tld not sudo npm…If you get permission errors, try starting from scratch by doing sudo npm uninstall -g local-tld.

— Reply to this email directly or view it on GitHubhttps://github.com/hoodiehq/local-tld/issues/10#issuecomment-16145973 .

— Reply to this email directly or view it on GitHub.

janl commented 11 years ago

so you want me to do an npm-install from inside the git repo, to get the lates code right?

Nope, it’s all on NPM already (<3 NPM).

Do this:

[sudo npm uninstall -g local-tld #optionsl]
npm install -g local-tld

(note that it wants to install local-tld version 3.0.3.)

janl commented 11 years ago

(3.0.4 now, don’t mind me fixing)

nborwankar commented 11 years ago

Ha! Catch22!

$ sudo npm uninstall -g local-tld #optionsl <hits same sudo loop! doesn't recognize my passwd>

I can just go rm -rf the local-tld dir in lib/node_modules and/or lib/node Does the installer leave droppings anywhere else?

Nitin


Nitin Borwankar nborwankar@gmail.com

On Tue, Apr 9, 2013 at 4:24 PM, Jan Lehnardt notifications@github.comwrote:

On Apr 10, 2013, at 00:22 , Nitin Borwankar notifications@github.com wrote:

OK so you want me to do an npm-install from inside the git repo, to get the lates code right?

Nope, it’s all on NPM already (<3 NPM).

Do this:

[sudo npm uninstall -g local-tld #optionsl]
npm install -g local-tld

Nitin Borwankar nborwankar@gmail.com

On Tue, Apr 9, 2013 at 4:19 PM, Jan Lehnardt notifications@github.comwrote:

@nborwankar https://github.com/nborwankar can you try the latest local-tld 3.0.3 I just pushed: #10< https://github.com/hoodiehq/local-tld/issues/10#issuecomment-16145973>

— Reply to this email directly or view it on GitHub< https://github.com/hoodiehq/local-tld/issues/10#issuecomment-16146518> .

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHubhttps://github.com/hoodiehq/local-tld/issues/10#issuecomment-16146666 .

janl commented 11 years ago

lolcopter :D

rm -rf the local-tld foler in your -g node_modules and manually run the contents of https://github.com/hoodiehq/local-tld/blob/master/bin/local-tld-uninstall

nborwankar commented 11 years ago

Jan,

So what was the issue you fixed?

I did the local uninstall and worked like a charm.

18:22][nitin@nitinmacbookpro:~/git/local-tld/bin(master)]$ ./local-tld-uninstall

Then so did the next steps, although there were a couple of OCD'ish complaints about nonexistent readme's and 'speling' from npm about dependent packages.

[18:19][nitin@nitinmacbookpro:~]$ npm install -g local-tld npm http GET https://registry.npmjs.org/local-tld npm http 200 https://registry.npmjs.org/local-tld npm http GET https://registry.npmjs.org/local-tld/-/local-tld-3.0.4.tgz npm http 200 https://registry.npmjs.org/local-tld/-/local-tld-3.0.4.tgz npm http GET https://github.com/sstephenson/dnsserver.js/archive/library.tar.gz npm http GET https://registry.npmjs.org/http-proxy npm http GET https://registry.npmjs.org/watchfd npm http 304 https://registry.npmjs.org/watchfd npm http 304 https://registry.npmjs.org/http-proxy npm http 200 https://github.com/sstephenson/dnsserver.js/archive/library.tar.gz npm http GET https://registry.npmjs.org/colors npm http GET https://registry.npmjs.org/optimist npm http GET https://registry.npmjs.org/pkginfo npm http 304 https://registry.npmjs.org/optimist npm http 304 https://registry.npmjs.org/colors npm http 304 https://registry.npmjs.org/pkginfo npm http GET https://registry.npmjs.org/wordwrap npm http 304 https://registry.npmjs.org/wordwrap

local-tld@3.0.4 postinstall /usr/local/lib/node_modules/local-tld ./bin/local-tld-setup

++ pwd

Onward!


Nitin Borwankar nborwankar@gmail.com

On Tue, Apr 9, 2013 at 4:41 PM, Jan Lehnardt notifications@github.comwrote:

lolcopter :D

rm -rf the local-tld foler in your -g node_modules and manually run the contents of https://github.com/hoodiehq/local-tld/blob/master/bin/local-tld-uninstall

— Reply to this email directly or view it on GitHubhttps://github.com/hoodiehq/local-tld/issues/10#issuecomment-16147282 .

nborwankar commented 11 years ago

So after the rest of the install which worked without errors, I created a hoodie app and am getting other errors. That's a separate issue so I'll open a different one. This one is now "works for me" :-)


Nitin Borwankar nborwankar@gmail.com

On Tue, Apr 9, 2013 at 6:29 PM, Nitin Borwankar nborwankar@gmail.comwrote:

Jan,

So what was the issue you fixed?

I did the local uninstall and worked like a charm.

18:22][nitin@nitinmacbookpro:~/git/local-tld/bin(master)]$ ./local-tld-uninstall

  • sudo launchctl unload /Library/LaunchDaemons/ie.hood.local-tld-firewall.plist
  • launchctl unload /Users/nitin/Library/LaunchAgents/ie.hood.local-tld-service.plist
  • sudo rm -f /Library/LaunchDaemons/ie.hood.local-tld-firewall.plist
  • rm -f /Users/nitin/Library/LaunchAgents/ie.hood.local-tld-service.plist
  • sudo rm -f /etc/resolver/dev

Then so did the next steps, although there were a couple of OCD'ish complaints about nonexistent readme's and 'speling' from npm about dependent packages.

[18:19][nitin@nitinmacbookpro:~]$ npm install -g local-tld npm http GET https://registry.npmjs.org/local-tld npm http 200 https://registry.npmjs.org/local-tld npm http GET https://registry.npmjs.org/local-tld/-/local-tld-3.0.4.tgz npm http 200 https://registry.npmjs.org/local-tld/-/local-tld-3.0.4.tgz npm http GET https://github.com/sstephenson/dnsserver.js/archive/library.tar.gz npm http GET https://registry.npmjs.org/http-proxy npm http GET https://registry.npmjs.org/watchfd npm http 304 https://registry.npmjs.org/watchfd npm http 304 https://registry.npmjs.org/http-proxy npm http 200 https://github.com/sstephenson/dnsserver.js/archive/library.tar.gz npm http GET https://registry.npmjs.org/colors npm http GET https://registry.npmjs.org/optimist npm http GET https://registry.npmjs.org/pkginfo npm http 304 https://registry.npmjs.org/optimist npm http 304 https://registry.npmjs.org/colors npm http 304 https://registry.npmjs.org/pkginfo npm http GET https://registry.npmjs.org/wordwrap npm http 304 https://registry.npmjs.org/wordwrap

local-tld@3.0.4 postinstall /usr/local/lib/node_modules/local-tld ./bin/local-tld-setup

++ pwd

  • PWD=/usr/local/lib/node_modules/local-tld ++ dirname ./bin/local-tld-setup
  • MY_PATH=./bin ++ cd ./bin ++ pwd
  • MY_PATH=/usr/local/lib/node_modules/local-tld/bin
  • ETC=/usr/local/lib/node_modules/local-tld/bin/../etc ++ npm root -g
  • NODE_ROOT=/usr/local/lib/node_modules
  • sed -e 's,{{NODE_ROOT}},/usr/local/lib/node_modules,' /usr/local/lib/node_modules/local-tld/bin/../etc/ie.hood.local-tld-service.plist.tpl
  • sudo mkdir -p /etc/resolver
  • sudo cp /usr/local/lib/node_modules/local-tld/bin/../etc/resolver.dev /etc/resolver/dev
  • sudo cp /usr/local/lib/node_modules/local-tld/bin/../etc/ie.hood.local-tld-firewall.plist /Library/LaunchDaemons/
  • cp /usr/local/lib/node_modules/local-tld/bin/../etc/ie.hood.local-tld-service.plist /Users/nitin/Library/LaunchAgents/
  • sudo launchctl load -Fw /Library/LaunchDaemons/ie.hood.local-tld-firewall.plist ie.hood.local-tld-firewall: Already loaded
  • launchctl unload /Users/nitin/Library/LaunchAgents/ie.hood.local-tld-service.plist
  • launchctl load -Fw /Users/nitin/Library/LaunchAgents/ie.hood.local-tld-service.plist
  • echo 'Setup done.' Setup done. npm WARN package.json assert@0.4.9 No README.md file found! npm WARN package.json jsdom-jquery-example@0.2.0 No README.md file found! npm WARN package.json path@0.4.9 No README.md file found! npm WARN package.json url@0.4.9 No README.md file found! npm WARN package.json util@0.4.9 No README.md file found! npm WARN package.json mustache@0.3.1-dev No README.md file found! npm WARN package.json connect@1.6.4 No README.md file found! npm WARN package.json cssom@0.2.2 No README.md file found! npm WARN package.json connect@1.7.1 No README.md file found! npm WARN package.json jquery@1.6.3 No README.md file found! npm WARN package.json events.node@0.4.9 No README.md file found! npm WARN package.json connect@1.6.0 No README.md file found! npm WARN package.json eventemitter2@0.4.1 'contributers' should probably be 'contributors' local-tld@3.0.4 /usr/local/lib/node_modules/local-tld ├── dnsserver@0.1.0 ├── watchfd@0.0.9 └── http-proxy@0.8.7 (colors@0.6.0-1, pkginfo@0.2.3, optimist@0.3.7) [18:20][nitin@nitinmacbookpro:~]$

Onward!


Nitin Borwankar nborwankar@gmail.com

On Tue, Apr 9, 2013 at 4:41 PM, Jan Lehnardt notifications@github.comwrote:

lolcopter :D

rm -rf the local-tld foler in your -g node_modules and manually run the contents of https://github.com/hoodiehq/local-tld/blob/master/bin/local-tld-uninstall

— Reply to this email directly or view it on GitHubhttps://github.com/hoodiehq/local-tld/issues/10#issuecomment-16147282 .

pagameba commented 11 years ago

The reason this is breaking is because you are running npm with sudo and within the postinstall script it is running sudo on some embedded commands. The context for sudo in the postinstall script is then incorrect and matches no known user so no password will match. I think that it should incorporate something like this:

if [ id -u -eq 0 ] then mkdir -p /etc/resolver cp $ETC/resolver.dev /etc/resolver/dev cp $ETC/ie.hood.local-tld-firewall.plist /Library/LaunchDaemons/ cp $ETC/ie.hood.local-tld-service.plist $HOME/Library/LaunchAgents/ launchctl load -Fw /Library/LaunchDaemons/ie.hood.local-tld-firewall.plist else sudo mkdir -p /etc/resolver sudo cp $ETC/resolver.dev /etc/resolver/dev sudo cp $ETC/ie.hood.local-tld-firewall.plist /Library/LaunchDaemons/ cp $ETC/ie.hood.local-tld-service.plist $HOME/Library/LaunchAgents/ sudo launchctl load -Fw /Library/LaunchDaemons/ie.hood.local-tld-firewall.plist fi

but I'm not a bash expert. Once you've used sudo npm install -g local-tld everything is all messed up and you can't properly uninstall or reinstall without manually removing the package from /usr/local/lib/node_modules/local-tld or fixing the permissions.

bbn commented 11 years ago

got it to work by manually wiping the install, changing the perms on my global module folder, then reinstalling without sudo.

not ideal - recommend perhaps rethinking whether this component is necessary for hood.ie

janl commented 11 years ago

local-tld is definitely part of the whole hoodie experience, there is no question. But given it’s brittle nature an trouble porting it to other systems with verbatim functionality makes me ponder making this an optional add-on for mac folks.

Before going there thought, I’d like to try and hammer out the kinks to see if it can be done :)

janl commented 11 years ago

@pagameba thanks, I committed 26870b4 which does just that, thanks :)

pagameba commented 11 years ago

you are welcome! I came across local-tld through a link to hood.ie, which sounds awesome. I wanted to try local-tld and ran into some difficulty so I was checking the issues and thought I might be able to lend some insight on this issue, glad it was of use :) Sadly I couldn't get local-tld to do anything and I ran out of time to troubleshoot it further.

cupofjoakim commented 11 years ago

I'm also having difficulties. Being given the typical sudo-loop just as @nborwankar. I erased everything and tried 'npm install -g local-tld' without sudo, here's the error:

npm ERR! Error: EACCES, open '/Users/joakim/.npm/8993e262-local-tld.lock' npm ERR! { [Error: EACCES, open '/Users/joakim/.npm/8993e262-local-tld.lock'] npm ERR! errno: 3, npm ERR! code: 'EACCES', npm ERR! path: '/Users/joakim/.npm/8993e262-local-tld.lock' } npm ERR! npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Darwin 12.3.0 npm ERR! command "/usr/local/Cellar/node/0.10.3/bin/node" "/usr/local/bin/npm" "install" "-g" "local-tld" npm ERR! cwd /Users/joakim npm ERR! node -v v0.10.3 npm ERR! npm -v 1.2.17 npm ERR! path /Users/joakim/.npm/8993e262-local-tld.lock npm ERR! code EACCES npm ERR! errno 3 npm ERR! stack Error: EACCES, open '/Users/joakim/.npm/8993e262-local-tld.lock' npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /Users/joakim/npm-debug.log npm ERR! not ok code 0

I'm also running mountain lion, btw.

pagameba commented 11 years ago

If you previously ran the command with sudo then there are likely some root-owned files left around, try deleting the lock file at /Users/joakim/.npm/8993e262-local-tld.lock manually and running it again.

cupofjoakim commented 11 years ago

It kind of puzzles me, but /Users/joakim/.npm/8993e262-local-tld.lock doesn't exist.

pagameba commented 11 years ago

what about permissions on /Users/joakim/.npm, is it writable by your user?

janl commented 11 years ago

I pushed a bunch of updates that should fix this. The problem is that you now have old artefacts that don't have the fixes.

Try this:

sudo rm -rf /path/to/global/node_modules sudo chmod -R $USER /path/to/global/node_modules npm install local-tld

On 11.04.2013, at 15:25, Joakim Wimmerstedt notifications@github.com wrote:

I'm also having difficulties. Being given the typical sudo-loop just as @nborwankar. I erased everything and tried 'npm install -g local-tld' without sudo, here's the error:

npm ERR! Error: EACCES, open '/Users/joakim/.npm/8993e262-local-tld.lock' npm ERR! { [Error: EACCES, open '/Users/joakim/.npm/8993e262-local-tld.lock'] npm ERR! errno: 3, npm ERR! code: 'EACCES', npm ERR! path: '/Users/joakim/.npm/8993e262-local-tld.lock' } npm ERR! npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Darwin 12.3.0 npm ERR! command "/usr/local/Cellar/node/0.10.3/bin/node" "/usr/local/bin/npm" "install" "-g" "local-tld" npm ERR! cwd /Users/joakim npm ERR! node -v v0.10.3 npm ERR! npm -v 1.2.17 npm ERR! path /Users/joakim/.npm/8993e262-local-tld.lock npm ERR! code EACCES npm ERR! errno 3 npm ERR! stack Error: EACCES, open '/Users/joakim/.npm/8993e262-local-tld.lock' npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /Users/joakim/npm-debug.log npm ERR! not ok code 0

I'm also running mountain lion, btw.

— Reply to this email directly or view it on GitHub.

cupofjoakim commented 11 years ago

It wasn't, so I changed it and now I recieved a new error:

npm http GET https://registry.npmjs.org/local-tld npm http 304 https://registry.npmjs.org/local-tld npm http GET https://registry.npmjs.org/local-tld/-/local-tld-3.0.5.tgz npm http 200 https://registry.npmjs.org/local-tld/-/local-tld-3.0.5.tgz npm ERR! Error: EPERM, chown '/Users/joakim/.npm/local-tld/3.0.5/package.tgz' npm ERR! { [Error: EPERM, chown '/Users/joakim/.npm/local-tld/3.0.5/package.tgz'] npm ERR! errno: 50, npm ERR! code: 'EPERM', npm ERR! path: '/Users/joakim/.npm/local-tld/3.0.5/package.tgz' } npm ERR! npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Darwin 12.3.0 npm ERR! command "/usr/local/Cellar/node/0.10.3/bin/node" "/usr/local/bin/npm" "install" "-g" "local-tld" npm ERR! cwd /Users/joakim npm ERR! node -v v0.10.3 npm ERR! npm -v 1.2.17 npm ERR! path /Users/joakim/.npm/local-tld/3.0.5/package.tgz npm ERR! code EPERM npm ERR! errno 50 npm ERR! stack Error: EPERM, chown '/Users/joakim/.npm/local-tld/3.0.5/package.tgz' npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /Users/jokkegoestasty/npm-debug.log npm ERR! not ok code 0

Should I post the contents of npm-debug?

EDIT: Going to try @janl's suggestion, hang on a minute

isaacs commented 11 years ago

sudo npm cache clean -f

On Thu, Apr 11, 2013 at 7:58 AM, Joakim Wimmerstedt < notifications@github.com> wrote:

It wasn't, so I changed it and now I recieved a new error:

npm http GET https://registry.npmjs.org/local-tld npm http 304 https://registry.npmjs.org/local-tld npm http GET https://registry.npmjs.org/local-tld/-/local-tld-3.0.5.tgz npm http 200 https://registry.npmjs.org/local-tld/-/local-tld-3.0.5.tgz npm ERR! Error: EPERM, chown '/Users/joakim/.npm/local-tld/3.0.5/package.tgz' npm ERR! { [Error: EPERM, chown '/Users/joakim/.npm/local-tld/3.0.5/package.tgz'] npm ERR! errno: 50, npm ERR! code: 'EPERM', npm ERR! path: '/Users/joakim/.npm/local-tld/3.0.5/package.tgz' }

npm ERR! npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Darwin 12.3.0 npm ERR! command "/usr/local/Cellar/node/0.10.3/bin/node" "/usr/local/bin/npm" "install" "-g" "local-tld" npm ERR! cwd /Users/joakim npm ERR! node -v v0.10.3 npm ERR! npm -v 1.2.17 npm ERR! path /Users/joakim/.npm/local-tld/3.0.5/package.tgz npm ERR! code EPERM npm ERR! errno 50 npm ERR! stack Error: EPERM, chown '/Users/joakim/.npm/local-tld/3.0.5/package.tgz'

npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /Users/jokkegoestasty/npm-debug.log

npm ERR! not ok code 0

Should I post the contents of npm-debug?

— Reply to this email directly or view it on GitHubhttps://github.com/hoodiehq/local-tld/issues/10#issuecomment-16239875 .

janl commented 11 years ago

Not sure, it looks like your NPM install is a bit hosed. Try making sure all paths belong to your current user.

On 11.04.2013, at 15:58, Joakim Wimmerstedt notifications@github.com wrote:

It wasn't, so I changed it and now I recieved a new error:

npm http GET https://registry.npmjs.org/local-tld npm http 304 https://registry.npmjs.org/local-tld npm http GET https://registry.npmjs.org/local-tld/-/local-tld-3.0.5.tgz npm http 200 https://registry.npmjs.org/local-tld/-/local-tld-3.0.5.tgz npm ERR! Error: EPERM, chown '/Users/joakim/.npm/local-tld/3.0.5/package.tgz' npm ERR! { [Error: EPERM, chown '/Users/joakim/.npm/local-tld/3.0.5/package.tgz'] npm ERR! errno: 50, npm ERR! code: 'EPERM', npm ERR! path: '/Users/joakim/.npm/local-tld/3.0.5/package.tgz' } npm ERR! npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Darwin 12.3.0 npm ERR! command "/usr/local/Cellar/node/0.10.3/bin/node" "/usr/local/bin/npm" "install" "-g" "local-tld" npm ERR! cwd /Users/joakim npm ERR! node -v v0.10.3 npm ERR! npm -v 1.2.17 npm ERR! path /Users/joakim/.npm/local-tld/3.0.5/package.tgz npm ERR! code EPERM npm ERR! errno 50 npm ERR! stack Error: EPERM, chown '/Users/joakim/.npm/local-tld/3.0.5/package.tgz' npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /Users/jokkegoestasty/npm-debug.log npm ERR! not ok code 0

Should I post the contents of npm-debug?

— Reply to this email directly or view it on GitHub.

cupofjoakim commented 11 years ago

Okay, so now I've cleansed my system from node (followed guide for node to make sure everything was gone), together with all the downloaded files, reinstalled them both, but still an error.

npm http GET https://registry.npmjs.org/local-tld npm http 304 https://registry.npmjs.org/local-tld npm http GET https://registry.npmjs.org/local-tld/-/local-tld-3.0.5.tgz npm http 200 https://registry.npmjs.org/local-tld/-/local-tld-3.0.5.tgz npm ERR! Error: EPERM, chown '/Users/joakim/.npm/local-tld/3.0.5/package.tgz' npm ERR! { [Error: EPERM, chown '/Users/joakim/.npm/local-tld/3.0.5/package.tgz'] npm ERR! errno: 50, npm ERR! code: 'EPERM', npm ERR! path: '/Users/joakim/.npm/local-tld/3.0.5/package.tgz' } npm ERR! npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Darwin 12.3.0 npm ERR! command "/usr/local/Cellar/node/0.10.3/bin/node" "/usr/local/bin/npm" "install" "-g" "local-tld" npm ERR! cwd /usr/local/Library npm ERR! node -v v0.10.3 npm ERR! npm -v 1.2.17 npm ERR! path /Users/joakim/.npm/local-tld/3.0.5/package.tgz npm ERR! code EPERM npm ERR! errno 50 npm ERR! stack Error: EPERM, chown '/Users/joakim/.npm/local-tld/3.0.5/package.tgz' npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /usr/local/Library/npm-debug.log npm ERR! not ok code 0

Fun thing is: I'm one of those front-enders who knows basically nothing about using the terminal. I'm learning loads here. I don't have any idea about how to make "all paths belong to my current user" though.

janl commented 11 years ago

Sorry this is giving you so much trouble!

npm ERR! Error: EPERM, chown '/Users/joakim/.npm/local-tld/3.0.5/package.tgz'

This means that the path /Users/joakim/.npm/local-tld/3.0.5 isn’t accessible to the current user. This is likely a permission issue in you ~/.npm/ path.

Can you try running this:

sudo chmod -R $USER ~/.npm

(assuming you are the user joakim) and then try

npm install -g local-tld

again?

Note: no sudo

cupofjoakim commented 11 years ago

I'm getting chmod: Invalid file mode: joakim on the first command.

janl commented 11 years ago

Eh, sorry, brainfart on my end. The command is:

sudo chown -R $USER ~/.npm
cupofjoakim commented 11 years ago

Hey, it worked! Thanks @janl!

janl commented 11 years ago

Wootwoot. Closing this one.

donaldpipowitch commented 11 years ago

Run into the same issue which was very annoying :(

I run 3.0.5 with sudo first even if the commit message "Protect against people accidentally using sudo npm install." says this shouldn't be possible? After that I searched in the wrong repo for help (hoodiehq/local-tld-lib) and somewhere in the middle of fixing this with the terminal prompts I had to reinstall node... Now everything works, but it consumed a lot of time and I can't see (yet) why local-tld isn't optional if you just want to test hoodie...?

bbn commented 11 years ago

+1 An unnecessary complication for hood.ie, and preventing the framework from being used by a lot of people.

janl commented 11 years ago

It is early days and I understand your frustration with issues around Hoodie, but these are inevitable and the entire team is incredibly grateful for you giving Hoodie a spin and take the time to report issues that we then can fix and make the Hoodie better and better.

I very much disagree though that this is unnecessary. I agree that Hoodie should work without local-tld and we are getting close to have that ready.

Local-tld makes the entire Hoodie experience so much nicer, that I consider it essential.

Please let us know if there are any existing issues. To my knowledge the latest version of local-tld works fine.

<3 Jan

On 15.04.2013, at 16:00, Ben Nevile notifications@github.com wrote:

+1 An unnecessary complication for hood.ie, and preventing the framework from being used by a lot of people.

— Reply to this email directly or view it on GitHub.

nborwankar commented 11 years ago

Hi Jan,

This deserves a separate discussion but can you lay out in bullet points what you consider to be the essence of "the Hoodie experience". I gather that the major goal is making it drop dead simple to create apps that have local-data-synced-with-cloud. Now with respect to this goal is local-tld a "must-have" or "really-really-really-nice-to-have". I think you're saying it's the latter. In which case why not proceed in steps - at least get it working as a baseline during the install. Take a check point and say now we add local-tld and even if you can't we still can do .......

If we lay out bullet points then we can draw a line which separates the must-haves from the others - right now it's not clear to the rest of us what the different benefits are vs the pain.

Do we have a hoodie-discuss on google groups to take this further?

Nitin


Nitin Borwankar nborwankar@gmail.com

On Mon, Apr 15, 2013 at 8:15 AM, Jan Lehnardt notifications@github.comwrote:

It is early days and I understand your frustration with issues around Hoodie, but these are inevitable and the entire team is incredibly grateful for you giving Hoodie a spin and take the time to report issues that we then can fix and make the Hoodie better and better.

I very much disagree though that this is unnecessary. I agree that Hoodie should work without local-tld and we are getting close to have that ready.

Local-tld makes the entire Hoodie experience so much nicer, that I consider it essential.

Please let us know if there are any existing issues. To my knowledge the latest version of local-tld works fine.

<3 Jan

On 15.04.2013, at 16:00, Ben Nevile notifications@github.com wrote:

+1 An unnecessary complication for hood.ie, and preventing the framework from being used by a lot of people.

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHubhttps://github.com/hoodiehq/local-tld/issues/10#issuecomment-16391026 .

janl commented 11 years ago

Not sure what needs discussing other than actual issues with the software.

Please report of anything does not work for you.

On 15.04.2013, at 19:36, Nitin Borwankar notifications@github.com wrote:

Hi Jan,

This deserves a separate discussion but can you lay out in bullet points what you consider to be the essence of "the Hoodie experience". I gather that the major goal is making it drop dead simple to create apps that have local-data-synced-with-cloud. Now with respect to this goal is local-tld a "must-have" or "really-really-really-nice-to-have". I think you're saying it's the latter. In which case why not proceed in steps - at least get it working as a baseline during the install. Take a check point and say now we add local-tld and even if you can't we still can do .......

If we lay out bullet points then we can draw a line which separates the must-haves from the others - right now it's not clear to the rest of us what the different benefits are vs the pain.

Do we have a hoodie-discuss on google groups to take this further?

Nitin


Nitin Borwankar nborwankar@gmail.com

On Mon, Apr 15, 2013 at 8:15 AM, Jan Lehnardt notifications@github.comwrote:

It is early days and I understand your frustration with issues around Hoodie, but these are inevitable and the entire team is incredibly grateful for you giving Hoodie a spin and take the time to report issues that we then can fix and make the Hoodie better and better.

I very much disagree though that this is unnecessary. I agree that Hoodie should work without local-tld and we are getting close to have that ready.

Local-tld makes the entire Hoodie experience so much nicer, that I consider it essential.

Please let us know if there are any existing issues. To my knowledge the latest version of local-tld works fine.

<3 Jan

On 15.04.2013, at 16:00, Ben Nevile notifications@github.com wrote:

+1 An unnecessary complication for hood.ie, and preventing the framework from being used by a lot of people.

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHubhttps://github.com/hoodiehq/local-tld/issues/10#issuecomment-16391026 .

— Reply to this email directly or view it on GitHub.

bbn commented 11 years ago

Well, for one thing, local-tld clobbers all of the local DNS I already have set up on my machine.

janl commented 11 years ago

Please define "local DNS".

On 15.04.2013, at 21:39, Ben Nevile notifications@github.com wrote:

Well, for one thing, local-tld clobbers all of the local DNS I already have set up on my machine.

— Reply to this email directly or view it on GitHub.

bbn commented 11 years ago

It's ok. If you are going to update hood.ie so that I can use it without local-tld, I can wait for that.