clkao / plv8x

Helpers for managing plv8 javascript modules
Other
68 stars 23 forks source link

missing cmd.js for global installation #11

Closed caasi closed 11 years ago

caasi commented 11 years ago

sudo npm i -g .

gets

npm ERR! Error: ENOENT, chmod '/usr/lib/node_modules/plv8x/bin/cmd.js'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Linux 3.11.0-12-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "i" "-g" "."
npm ERR! cwd /home/caasi/Documents/g0v/plv8x
npm ERR! node -v v0.10.21
npm ERR! npm -v 1.3.11
npm ERR! path /usr/lib/node_modules/plv8x/bin/cmd.js
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/caasi/Documents/g0v/plv8x/npm-debug.log
npm ERR! not ok code 0

but

npm i
sudo npm i -g .

works

clkao commented 11 years ago

does it work if bin points to cmd.ls in package.{ls,json} ?

caasi commented 11 years ago

I got this after I changed every cmd.js to cmd.ls in package.{ls, json}:

$ plv8x -d test -l
/usr/bin/plv8x: line 1: #!/usr/bin/env: No such file or directory
/usr/bin/plv8x: line 2: syntax error near unexpected token `newline'
/usr/bin/plv8x: line 2: `require! <[fs resolve pg]>'
caasi commented 11 years ago

狀況一

sudo npm i -g .

prepublish 沒跑,找不到 cmd.js ,安裝失敗。

狀況二

npm run prepublish
sudo npm i -g .
plv8x -d test -l

安裝成功,但是 cmd.js 是用之前裝的 LiveScript 1.2.0 編譯, 而不是使用 plv8x 需要的 1.1.1 ,結果跑不起來。

狀況三

npm i
sudo npm i -g .
plv8x -d test -l

安裝成功。 測試失敗,無法以帳密連結資料庫。 (目前以 Unix user 登入 PostgreSQL 。)

audreyt commented 11 years ago

Try something like this:

sudo su postgres -c 'createuser -s caasi'
caasi commented 11 years ago

Before running:

sudo su postgres -c 'createuser -s caasi'

I dropped the old user:

DROP DATABASE test;
DROP DATABASE zh;
DROP ROLE caasi;

but I still got:

events.js:72
        throw er; // Unhandled 'error' event
              ^
error: password authentication failed for user "caasi"
    at Connection.parseE (/usr/lib/node_modules/plv8x/node_modules/pg/lib/connection.js:526:11)
    at Connection.parseMessage (/usr/lib/node_modules/plv8x/node_modules/pg/lib/connection.js:371:17)
    at Socket.<anonymous> (/usr/lib/node_modules/plv8x/node_modules/pg/lib/connection.js:86:20)
    at Socket.EventEmitter.emit (events.js:95:17)
    at Socket.<anonymous> (_stream_readable.js:746:14)
    at Socket.EventEmitter.emit (events.js:92:17)
    at emitReadable_ (_stream_readable.js:408:10)
    at emitReadable (_stream_readable.js:404:5)
    at readableAddChunk (_stream_readable.js:165:9)
    at Socket.Readable.push (_stream_readable.js:127:10)

after running plv8x -d test -l with the user created by sudo su postgres -c 'createuser -s caasi'

audreyt commented 11 years ago

Try edit /etc/postgresql/*/main/pg_hba.conf and add this line, then sudo service postgresql restart:

local   all    all         ident
caasi commented 11 years ago

It works after I installed oidentd and changed:

# IPv4 local connections:
host    all             all             127.0.0.1/32            md5

to:

# IPv4 local connections:
host    all             all             127.0.0.1/32            ident
caasi commented 11 years ago

Anyway, thanks for the help!

BTW, will plv8x be published with precompiled *.js in the future?

clkao commented 11 years ago

@cassi the version on npm will always have *.js bundled, so we just need to make sure it works in both dev env and from npm

caasi commented 11 years ago

@clkao I see, I should do sudo npm i -g plv8x if I just want to use it.

And if I am a developer, I will always do the npm i first after cloning.

davehorner commented 10 years ago

I am still getting this error using Ubuntu 12.04 npm ERR! Error: ENOENT, chmod '/usr/lib/node_modules/plv8x.git/bin/cmd.js' cmd.ls in bin, no cmd.js

I did get it to work using @caasi suggestion to use npm i -g plv8x. Can we update the website to reflect this suggestion for normal user install?

https://github.com/clkao/plv8x indicates a npm i -g . should be enough, but this closed ticket shows that is not the case. why does ident make a difference?

anyways, thank you, I've installed it from npm. just wanted to make the suggestion for future users. Thanks. --dave http://dave.thehorners.com/tech-talk/random-tech/500-postgresql