web3 / web3.js

Collection of comprehensive TypeScript libraries for Interaction with the Ethereum JSON RPC API and utility functions.
https://web3js.org/
Other
19.39k stars 4.97k forks source link

can't install web3.js through npm on macos #1549

Closed ghost closed 6 years ago

ghost commented 6 years ago

I tried to install web3 through npm

npm install --save web3

And i got this problem:

` Buis-MacBook-Pro:Apartment-rent-MERNstack stephen$ npm install web3

scrypt@6.0.3 preinstall /Users/stephen/Desktop/Apartment-rent-MERNstack/node_modules/scrypt node node-scrypt-preinstall.js

Error: Error: Command failed: ./configure configure: error: in /Users/stephen/Desktop/Apartment-rent- MERNstack/node_modules/scrypt/scrypt/scrypt-1.2.0': configure: error: C compiler cannot create executables Seeconfig.log' for more details

scrypt@6.0.3 install /Users/stephen/Desktop/Apartment-rent-MERNstack/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

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.

gyp: No Xcode or CLT version detected! gyp ERR! configure error gyp ERR! stack Error: gyp failed with exit code: 1 gyp ERR! stack at ChildProcess.onCpExit (/Users/stephen/.nvm/versions/node/v8.10.0/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 "/Users/stephen/.nvm/versions/node/v8.10.0/bin/node" "/Users/stephen/.nvm/versions/node/v8.10.0/lib/node_modules/npm/node_modules/node- gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /Users/stephen/Desktop/Apartment-rent-MERNstack/node_modules/scrypt gyp ERR! node -v v8.10.0 gyp ERR! node-gyp -v v3.6.2 gyp ERR! not ok npm WARN ajv-keywords@3.1.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! scrypt@6.0.3 install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the scrypt@6.0.3 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/stephen/.npm/_logs/2018-04-14T12_06_57_259Z-debug.log`

Can anyone explain pls ?

iurimatias commented 6 years ago

@HoangThongBui you need to install x-code command line tools , see a guide like http://railsapps.github.io/xcode-command-line-tools.html

ghost commented 6 years ago

I have Xcode already sir, latest version

iurimatias commented 6 years ago

hi @HoangThongBui this is a issue specific to the scrypt package (try npm -g install scrypt), and the log provided indicates there is also an issue with your Xcode installation "error: tool 'xcodebuild' requires Xcode,". I've seen this before, and it's always an issue with x-code or the dev not installing the command line tools option for x-code

CamposBruno commented 6 years ago

this did the work for me http://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/. I hope it helps you too.

claudebarde commented 5 years ago

@CamposBruno This definitely worked for me, thanks a lot!

UVStudio commented 5 years ago

Hi @iurimatias and @CamposBruno Just wanted to say thank you for your posts here. Took me hours to figure out how to install web3 1.0.0 on Node 10.15 on mac. Seems like I just didn't have Xcode.

cagill3 commented 5 years ago

@UVStudio I have the latest version of Xcode but I’m still getting error msgs. When I do "npm install - -save web3" there are a bunch of web3 packages that gets added inside the node_modules folder but I still get a lot of error msgs and web3 does not get added to the dependencies list inside the package.json file like it should. Were you having this problem at first?