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

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

Open
olostan opened this issue Dec 27, 2013 · 17 comments
Open

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

olostan opened this issue Dec 27, 2013 · 17 comments

Comments

@olostan
Copy link

olostan commented Dec 27, 2013

During installing 'usage' I got:

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

> [email protected] 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! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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
Copy link

Mark here

@arunoda
Copy link
Owner

arunoda commented Dec 27, 2013

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

@olostan
Copy link
Author

olostan commented Dec 27, 2013

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
Copy link
Owner

arunoda commented Dec 27, 2013

I think that's a good idea.

@olostan
Copy link
Author

olostan commented Dec 27, 2013

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
Copy link

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

@workingmatt
Copy link

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
Copy link
Author

olostan commented Jan 2, 2014

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

@onesmartguy
Copy link

Same issue here

@pawsong
Copy link

pawsong commented Jan 7, 2014

node-gyp@~0.11 works.

@olostan
Copy link
Author

olostan commented Jan 7, 2014

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

@workingmatt
Copy link

@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"
  },
  1. 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
Copy link

pawsong commented Jan 9, 2014

@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 [email protected] 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 [email protected], [email protected]), pm2 can be successfully installed. As you may know, pm2 on node 0.10.x has a known issue about releasing port (Unitech/pm2#74), which can be solved by using fork option.

@workingmatt
Copy link

@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 [email protected]
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
Copy link

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

@itayw
Copy link

itayw commented Mar 6, 2014

+1 @workingmatt

@HugoCapocci
Copy link

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

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

No branches or pull requests

9 participants