Web3.js: MacOS npm install web3 doesn't work

Created on 15 Jul 2018  路  13Comments  路  Source: ChainSafe/web3.js

<username>@216-71-221-163 ~/programming/blockchain/putOnChain $ npm install web3
npm WARN deprecated [email protected]: Use mz or fs-extra^3.0 with Promise Support
npm WARN deprecated [email protected]: 鈿狅笍  WARNING 鈿狅笍 tar.gz module has been deprecated and your application is vulnerable. Please use tar module instead: https://npmjs.com/tar

> [email protected] preinstall /Users/<username>/programming/blockchain/putOnChain/node_modules/scrypt
> node node-scrypt-preinstall.js


> [email protected] install /Users/<username>/programming/blockchain/putOnChain/node_modules/scrypt
> node-gyp rebuild

gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

Traceback (most recent call last):
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 16, in <module>
    sys.exit(gyp.script_main())
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 545, in script_main
    return main(sys.argv[1:])
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 538, in main
    return gyp_main(args)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 523, in gyp_main
    generator.GenerateOutput(flat_list, targets, data, params)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 2170, in GenerateOutput
    part_of_all=qualified_target in needed_targets)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 817, in Write
    mac_bundle_deps, extra_outputs, part_of_all)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 1453, in WriteTarget
    lambda p: Sourceify(self.Absolutify(p)))
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 809, in GetLdflags
    archs = self.GetActiveArchs(self.configname)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 420, in GetActiveArchs
    xcode_archs_default = GetXcodeArchsDefault()
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 118, in GetXcodeArchsDefault
    xcode_version, _ = XcodeVersion()
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1265, in XcodeVersion
    version = re.match(r'(\d\.\d\.?\d*)', version).groups()[0]
AttributeError: 'NoneType' object has no attribute 'groups'
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:336:16)
gyp ERR! stack     at ChildProcess.emit (events.js:180:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)
gyp ERR! System Darwin 17.4.0
gyp ERR! command "/usr/local/Cellar/node/9.11.1/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/<username>/programming/blockchain/putOnChain/node_modules/scrypt
gyp ERR! node -v v9.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
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 probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/<username>/.npm/_logs/2018-07-15T20_20_18_849Z-debug.log
support

All 13 comments

The log file is quite huge with 6118 line in it, the point is, if such a simple operation as install web3.js fails - the output should be 1) comprehensible 2) short 3) perhaps should use less dependencies.

Sounds like it's xcode issue https://github.com/nodejs/node-gyp/issues/569, however, still, majority of other npm packages work just fine.

No, it's not xcode issue, on windows it also doesn't work. For my friend's computer (win 10, npm -v 5.8.0)

npm init
npm install web3
npm WARN deprecated [email protected]: Use mz or fs-extra^3.0 with Promise Support
npm WARN deprecated [email protected]: 鈿狅笍  WARNING 鈿狅笍 tar.gz module has been deprecated and your application is vulnerable. Please use tar module instead: https://npmjs.com/tar

> [email protected] preinstall C:\Users\benna\Desktop\SideProjects\temp\node_modules\scrypt
> node node-scrypt-preinstall.js


> [email protected] install C:\Users\benna\Desktop\SideProjects\temp\node_modules\scrypt
> node-gyp rebuild


C:\Users\benna\Desktop\SideProjects\temp\node_modules\scrypt>if not defined npm_config_node_gyp (node "C:\Users\benna\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Users\benna\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (C:\Users\benna\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack     at PythonFinder.<anonymous> (C:\Users\benna\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack     at C:\Users\benna\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:154:21)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\benna\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\npm-lifecycle\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\benna\Desktop\SideProjects\temp\node_modules\scrypt
gyp ERR! node -v v8.8.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
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 probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\benna\AppData\Roaming\npm-cache\_logs\2018-07-17T02_54_42_908Z-debug.log

@lebed2045 your friend's computer is missing python in his PATH.
Maybe an update of NPM and node will help you.
I can't reproduce this on my macbook.

OS: macOS High Sierra 10.13.6
NPM: 6.1.0
Node: 10.0.5

@nivida npm update doesn't help. The fact that during hackathon only on one computer out of 6 npm install web3 worked somehow, should signal about some issue with web3 install workflow. More of that, even on this only computer (mac Sierra) npm install web3@^1.0.0 worked not as it suppose to work, it's installed somehow 0.2xx version with old function names. Of course we figured out eventually a solution like 2 days after but this fact shows how user unfriendly is to work with web3 on nodejs.

Just went through this without any luck. Any update here?

I have the same error.

gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:336:16)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Darwin 17.4.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/tboy/Documents/dev/Tobius/ngnc/node_modules/scrypt
gyp ERR! node -v v8.11.3
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
npm WARN The package rollup-plugin-babel is included as both a dev and production dependency.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.

I tried installing the other web3 beta versions and they all failed at the same spot. I am using a MacOS High Sierra. Please someone should really revisit web3 installation workflow. Thanks.

@lebed2045 What was the solution that you guys found after 2 days?

Also I've had a look at the node-gyp docs and it states that python v3.x.x is NOT supported. Could you check the python version installed on your mac?

I have v2.7.0 and no issues installing web3 whatsoever.

could be the issue bcoz of npm or node's version.

I'm still seeing this issue!

AttributeError: 'NoneType' object has no attribute 'groups'
$ node -v
v8.11.3
$ npm -v
5.6.0
$ python --version
Python 3.7.3
$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 10.2.0.0.1.1552586384
volume: /
location: /
install-time: 1553821839
groups: com.apple.FindSystemFiles.pkg-group 

Tried:

  1. npm install -g node-gyp. Didn't help
  2. Upgrade python from 2 to 3. Didn't help

Closed because of the ongoing clean up of the issue list. Feel free to ask this in our gitter channel or on stackoverflow.

I tried to go around this issue. Changed to root (sudo su) proceeded almost doned installation, it means project wich want's web3 starting running and after this proceed to the:
Memory limit exceeded for Node's built-in crypto.scrypt, falling back to scryptsy (times: 1), if this happens frequently you can improve web3's peformance when running Node.js versions older than 12.0.0 by installing the (deprecated) scrypt package in your project 2019-10-08T14:13:37.443Z - error: [main] fatal error Error: connect ECONNREFUSED 127.0.0.1:5672 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1106:14) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] start:node ./bin/www`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/a111/.npm/_logs/2019-10-08T14_13_37_460Z-debug.log
`
In google found that this web3 needed a ethereum node runned local or remote.
Any ideas?

Was this page helpful?
0 / 5 - 0 ratings