arunoda / node-usage

process usage lookup with nodejs
MIT License
389 stars 93 forks source link

AttributeError: 'module' object has no attribute 'script_main' #19

Open olostan opened 10 years ago

olostan commented 10 years ago

During installing 'usage' I got:

node -v v0.11.9 node-gyp -v v0.12.2 Python 2.6.6

> usage@0.3.9 install /home/olostan/temp/_del/node_modules/usage
> node-gyp rebuild

Traceback (most recent call last):
  File "/home/olostan/.nvm/v0.11.9/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 18, in <module>
    sys.exit(gyp.script_main())
AttributeError: 'module' object has no attribute 'script_main'
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/home/olostan/.nvm/v0.11.9/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:337:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:101:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:827:12)
gyp ERR! System Linux 2.6.32-358.23.2.el6.x86_64
gyp ERR! command "node" "/home/olostan/.nvm/v0.11.9/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/olostan/temp/_del/node_modules/usage
gyp ERR! node -v v0.11.9
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm ERR! usage@0.3.9 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the usage@0.3.9 install script.
npm ERR! This is most likely a problem with the usage package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls usage
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 2.6.32-358.23.2.el6.x86_64
npm ERR! command "node" "/home/olostan/.nvm/v0.11.9/bin/npm" "install" "usage"
npm ERR! cwd /home/olostan/temp/_del
npm ERR! node -v v0.11.9
npm ERR! npm -v 1.3.22
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /home/olostan/temp/_del/npm-debug.log
npm ERR! not ok code 0
kelvinlee commented 10 years ago

Mark here

arunoda commented 10 years ago

Seems like gyp having some issues. @TooTallNate any ideas why?

olostan commented 10 years ago

IS there any sense of creating issue on node_gyp so authors will try to find the solution? May signature of some node_gyp methods where changed?

arunoda commented 10 years ago

I think that's a good idea.

olostan commented 10 years ago

Can someone who is more familiar with how node-usage using node-gyp describe what could be a problem to make in issue at node-gyp more specific? Because for me, npm install node-gyp finish without any problem... So looks like there is something with using it.

kelvinlee commented 10 years ago

I have the problem same as @olostan npm install node-gyp is alright. npm install usage -g has this problem.

workingmatt commented 10 years ago

Like @kelvinlee I too have this issue. node install node-gyp -g works fine for me too, however npm install usage also fails with an almost identical output as @olostan (so similar I didn't think it was worth pasting my output here but have emailed it to @arunoda).

olostan commented 10 years ago

Did anybody found any workaround? (another version of node/node-gyp?)

onesmartguy commented 10 years ago

Same issue here

pawsong commented 10 years ago

node-gyp@~0.11 works.

olostan commented 10 years ago

@gifarangw you was able to install node-usage wuth node-gyp version 0.11?

workingmatt commented 10 years ago

@gifarangw @olostan I have cloned node-gyp and node-usage repositories then did the following: 1) Rolled back node-gyp to v0.11.0 (with git checkout 170c1a9....) 2) npm install -g from the node-gyp directory I just cloned
3) Altered npm-usage/package.json by adding "node-gyp": "~0.11", before the bindings entry so the dependencies looked like this:

"dependencies": {
     "node-gyp": "~0.11",
     "bindings": "1.x.x"
  },

4) Ran npm install -g from the node-usage folder.

Unfortunately, I got the same errors as before, including a gyp ERR! node-gyp -v 0.12.1 which suggests I'm doing something noobish. Any suggestions @gifarangw?

PS I came across this problem while trying to install PM2 on CentOS 6.5. I can install PM2 and therefore node-usage on Mac OSX Lion and Ubuntu.

pawsong commented 10 years ago

@olostan @workingmatt I manually altered node-gyp version under npm's directory by executing commands as follow:

1) cd $HOME/.nvm/v0.11.9/lib/node_modules/npm 2) npm install node-gyp@~0.11

Env:

CentOS release 6.4 (Final) LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch CentOS release 6.4 (Final) CentOS release 6.4 (Final)

In my case this solves node-usage installation problem, but node v0.11.9 with node-gyp@0.11 makes some errors while installing other modules...... I decided to rollback node version to v0.10.24, official stable version.

@workingmatt I also encountered this error while installing pm2 on CentOS machine. After changing node version to v0.10.24 (with npm@1.3.6, node-gyp@0.10.6), pm2 can be successfully installed. As you may know, pm2 on node 0.10.x has a known issue about releasing port (https://github.com/Unitech/pm2/issues/74), which can be solved by using fork option.

workingmatt commented 10 years ago

@gifarangw thank you. Your approach worked for me with a subtle change to the path used because I'm not using nvm just npm and node v0.10.24 on CentOS 6.4

cd /usr/lib/node_modules/npm npm install node-gyp@0.10.6 cd ~ npm install -g pm2

PM2 is now working on CentOS, but I think this is a workaround and this issue should remain open for usage and/or node-gyp.

reydelleon commented 10 years ago

+1 to @workingmatt for his comment. It worked very well for me, but I had to reinstall NodeJS from source.

itayw commented 10 years ago

+1 @workingmatt

HugoCapocci commented 10 years ago

don't work with node 0.10.26 a npm 1.4.4 => error code ELIFECYCLE

stay in 0.10.24 guys... I 'll try tommorrow