windows10如何手動安裝web3最新版本?
我使用npm install web3將安裝(截至目前)v1.0.0-beta.41
但它給了我以下錯誤:
E:\sheep\node_modules\sha3>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild ) Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. E:\sheep\node_modules\sha3\build\sha3.vcxproj(20,3): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Default.props" was not found. Confirm that the p ath in the <Import> declaration is correct, and that the file exists on disk. gyp ERR! build error gyp ERR! stack Error: `msbuild` failed with exit code: 1 gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23) gyp ERR! stack at ChildProcess.emit (events.js:182:13) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12) gyp ERR! System Windows_NT 10.0.17134 gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" gyp ERR! cwd E:\sheep\node_modules\sha3 gyp ERR! node -v v10.14.2 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok npm WARN enoent ENOENT: no such file or directory, open 'E:\sheep\package.json' npm WARN sheep No description npm WARN sheep No repository field. npm WARN sheep No README data npm WARN sheep No license field. npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! sha3@1.2.2 install: `node-gyp rebuild` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the sha3@1.2.2 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
dir node_modules 的輸出(我在一個空文件夾中做了 npm install web3)
Directory of E:\node_modules <DIR> . <DIR> .. <DIR> .bin <DIR> @babel <DIR> @types <DIR> accepts <DIR> aes-js <DIR> ajv <DIR> array-flatten <DIR> asn1 <DIR> asn1.js <DIR> assert-plus <DIR> async-limiter <DIR> asynckit <DIR> aws-sign2 <DIR> aws4 <DIR> base64-js <DIR> bcrypt-pbkdf <DIR> bl <DIR> bluebird <DIR> bn.js <DIR> body-parser <DIR> brorand <DIR> browserify-aes <DIR> browserify-cipher <DIR> browserify-des <DIR> browserify-rsa <DIR> browserify-sha3 <DIR> browserify-sign <DIR> buffer <DIR> buffer-alloc <DIR> buffer-alloc-unsafe <DIR> buffer-crc32 <DIR> buffer-fill <DIR> buffer-to-arraybuffer <DIR> buffer-xor <DIR> bytes <DIR> caseless <DIR> chownr <DIR> cipher-base <DIR> combined-stream <DIR> commander <DIR> content-disposition <DIR> content-type <DIR> cookie <DIR> cookie-signature <DIR> cookiejar <DIR> core-util-is <DIR> cors <DIR> create-ecdh <DIR> create-hash <DIR> create-hmac <DIR> crypto-browserify <DIR> dashdash <DIR> debug <DIR> decode-uri-component <DIR> decompress <DIR> decompress-response <DIR> decompress-tar <DIR> decompress-tarbz2 <DIR> decompress-targz <DIR> decompress-unzip <DIR> delayed-stream <DIR> depd <DIR> des.js <DIR> destroy <DIR> diffie-hellman <DIR> dom-walk <DIR> duplexer3 <DIR> ecc-jsbn <DIR> ee-first <DIR> elliptic <DIR> encodeurl <DIR> end-of-stream <DIR> escape-html <DIR> etag <DIR> eth-ens-namehash <DIR> eth-lib <DIR> ethers <DIR> ethjs-unit <DIR> eventemitter3 <DIR> evp_bytestokey <DIR> express <DIR> extend <DIR> extsprintf <DIR> fast-deep-equal <DIR> fast-json-stable-stringify <DIR> fd-slicer <DIR> file-type <DIR> finalhandler <DIR> for-each <DIR> forever-agent <DIR> form-data <DIR> forwarded <DIR> fresh <DIR> fs-constants <DIR> fs-extra <DIR> fs-minipass <DIR> get-stream <DIR> getpass <DIR> global <DIR> got <DIR> graceful-fs <DIR> graceful-readlink <DIR> har-schema <DIR> har-validator <DIR> has-symbol-support-x <DIR> has-to-string-tag-x <DIR> hash-base <DIR> hash.js <DIR> hmac-drbg <DIR> http-errors <DIR> http-https <DIR> http-signature <DIR> iconv-lite <DIR> idna-uts46-hx <DIR> ieee754 <DIR> inherits <DIR> ipaddr.js <DIR> is-callable <DIR> is-function <DIR> is-hex-prefixed <DIR> is-natural-number <DIR> is-object <DIR> is-plain-obj <DIR> is-retry-allowed <DIR> is-stream <DIR> is-typedarray <DIR> isarray <DIR> isstream <DIR> isurl <DIR> js-sha3 <DIR> jsbn <DIR> json-schema <DIR> json-schema-traverse <DIR> json-stringify-safe <DIR> jsonfile <DIR> jsprim <DIR> keccakjs <DIR> lodash <DIR> lowercase-keys <DIR> make-dir <DIR> md5.js <DIR> media-typer <DIR> merge-descriptors <DIR> methods <DIR> miller-rabin <DIR> mime <DIR> mime-db <DIR> mime-types <DIR> mimic-response <DIR> min-document <DIR> minimalistic-assert <DIR> minimalistic-crypto-utils <DIR> minimist <DIR> minipass <DIR> minizlib <DIR> mkdirp <DIR> mkdirp-promise <DIR> mock-fs <DIR> ms <DIR> nan <DIR> nano-json-stream-parser <DIR> negotiator <DIR> number-to-bn <DIR> oauth-sign <DIR> object-assign <DIR> oboe <DIR> on-finished <DIR> once <DIR> p-cancelable <DIR> p-finally <DIR> p-timeout <DIR> parse-asn1 <DIR> parse-headers <DIR> parseurl <DIR> path-to-regexp <DIR> pbkdf2 <DIR> pend <DIR> performance-now <DIR> pify <DIR> pinkie <DIR> pinkie-promise <DIR> prepend-http <DIR> process <DIR> process-nextick-args <DIR> proxy-addr <DIR> psl <DIR> public-encrypt <DIR> punycode <DIR> qs <DIR> query-string <DIR> querystringify <DIR> randombytes <DIR> randomfill <DIR> randomhex <DIR> range-parser <DIR> raw-body <DIR> readable-stream <DIR> regenerator-runtime <DIR> request <DIR> requires-port <DIR> ripemd160 <DIR> safe-buffer <DIR> safer-buffer <DIR> scrypt-js <DIR> scryptsy <DIR> seek-bzip <DIR> send <DIR> serve-static <DIR> servify <DIR> setimmediate <DIR> setprototypeof <DIR> sha.js <DIR> sha3 <DIR> simple-concat <DIR> simple-get <DIR> sshpk <DIR> statuses <DIR> strict-uri-encode <DIR> string_decoder <DIR> strip-dirs <DIR> strip-hex-prefix <DIR> swarm-js <DIR> tar <DIR> tar-stream <DIR> through <DIR> timed-out <DIR> to-buffer <DIR> tough-cookie <DIR> trim <DIR> tunnel-agent <DIR> tweetnacl <DIR> type-is <DIR> typedarray-to-buffer <DIR> ultron <DIR> unbzip2-stream <DIR> universalify <DIR> unpipe <DIR> uri-js <DIR> url-parse <DIR> url-parse-lax <DIR> url-set-query <DIR> url-to-options <DIR> utf8 <DIR> util-deprecate <DIR> utils-merge <DIR> uuid <DIR> vary <DIR> verror <DIR> web3-bzz <DIR> web3-core <DIR> web3-core-helpers <DIR> web3-core-method <DIR> web3-core-promievent <DIR> web3-core-subscriptions <DIR> web3-eth-abi <DIR> web3-eth-iban <DIR> web3-eth-personal <DIR> web3-net <DIR> web3-providers <DIR> web3-shh <DIR> web3-utils <DIR> websocket <DIR> wrappy <DIR> ws <DIR> xhr <DIR> xhr-request <DIR> xhr-request-promise <DIR> xhr2-cookies <DIR> xmlhttprequest <DIR> xtend <DIR> yaeti <DIR> yallist <DIR> yauzl
. 然後我在 regedit(“Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\4.0”) 中添加了一個 reg 鍵作為**“VCTargetsPath” : “$(MSBuildExtensionsPath32)\Microsoft.Cpp\v4.0\V140”** 但它仍然無法正常工作即,它給出了與提到的相同的錯誤。
我可以安裝 web3@0.20.7,但我想要最新版本,因為 0.20.7 中的一些功能已在 v1.0.0 中刪除/重新排列我所需要的是當我需要時 nodejs 不應該抱怨(‘web3’) .
我想知道如何安裝帶有依賴項的 web3 包。還有如何告訴 E:\node_modules\scrypt\build\scrypt_wrapper.vcxproj(我檢查時 node_modules 內沒有scrypt文件夾)使用 V140 或任何已安裝的 platformSetTools。
我在C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0中有以下文件夾
- V120
- V140
是否可以將安裝在其他人系統上的 web3(帶有依賴項)合併到我的系統中?
更新: 我在目前電腦上安裝了以下軟體:
- 視覺工作室 2015
- Microsoft .NET Framework(4.5 多目標包 (MTP)、4.5 sdk、4.5.1 MTP、4.5.1 MTP (ENU)、4.5.1 SDK、4.5.2 SDK、4.5.2 MTP、4.5.2 MTP ENU、 4.6 SDK, 4.6 目標包, 4.6 TP ENU, 4.6.1 SDK, 4.6.1 TP, 4.6.1 TP ENU, 4.7 SDK, 4.7 TP, 4.7 TP ENU)
- 微軟 Visual C++ (2008,2012,2013,2017)
我也可以在 Windows 7(也有 Visual Studio 2015)中*npm install web3並且它執行/安裝沒有錯誤。*這是嘗試安裝 windows-build-tools 和 web3 包後的輸出。
PS E:\sheep\dir2> npm --global install windows-build-tools > windows-build-tools@5.1.0 postinstall C:\Users\pebble\AppData\Roaming\npm\node_modules\windows-build-tools > node ./dist/index.js Downloading vs_BuildTools.exe [> ] 0.0% (0 B/s) Downloaded vs_BuildTools.exe. Saved to C:\Users\pebble\.windows-build-tools\vs_BuildTools.exe. Starting installation... Launched installers, now waiting for them to finish. This will likely take some time - please be patient! Status from the installers: ---------- Visual Studio Build Tools ---------- Successfully installed Visual Studio Build Tools. ------------------- Python -------------------- Python 2.7.13 is already installed, not installing again. Now configuring the Visual Studio Build Tools.. All done! + windows-build-tools@5.1.0 updated 1 package in 31.626s PS E:\sheep\dir2> npm install web3 > scrypt@6.0.3 preinstall E:\sheep\dir2\node_modules\scrypt > node node-scrypt-preinstall.js > scrypt@6.0.3 install E:\sheep\dir2\node_modules\scrypt > node-gyp rebuild E:\sheep\dir2\node_modules\scrypt>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild ) Warning: Missing input files: E:\sheep\dir2\node_modules\scrypt\build\..\scrypt\win\include\config.h Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. E:\sheep\dir2\node_modules\scrypt\build\copied_files.vcxproj(20,3): error MSB4019: The imported project "C:\Program Files (x86)\MSBui ld\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. E:\sheep\dir2\node_modules\scrypt\build\scrypt_wrapper.vcxproj(20,3): error MSB4019: The imported project "C:\Program Files (x86)\MSB uild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct , and that the file exists on disk. gyp ERR! build error gyp ERR! stack Error: `msbuild` failed with exit code: 1 gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23) gyp ERR! stack at ChildProcess.emit (events.js:182:13) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12) gyp ERR! System Windows_NT 10.0.17134 gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" gyp ERR! cwd E:\sheep\dir2\node_modules\scrypt gyp ERR! node -v v10.14.2 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok npm WARN enoent ENOENT: no such file or directory, open 'E:\sheep\dir2\package.json' npm WARN dir2 No description npm WARN dir2 No repository field. npm WARN dir2 No README data npm WARN dir2 No license field. 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. Terminate batch job (Y/N)? ^C
不確定(因為您沒有提供完整的錯誤日誌),但我認為問題出在 some
build-tools
上,安裝它會解決您的問題。npm install -g windows-build-tools
**注意:**確保
windows-build-tools
全域安裝。
- 解除安裝/重新安裝節點(也刪除了本地目錄中的所有相關文件夾,包括漫遊)
- 在 POWERSHELL 中作為管理員:
npm install --global --production windows-build-tools
npm install --save --no-optional web3
.希望這對你有用。