我使用npm安装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的输出(我在一个空文件夹中安装了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中没有氪星文件夹)使用V140或任何已安装的platformSetTools。
我在C中有以下文件夹:\Program (x86)\MSBuild\Microsoft.Cpp\v4.0
另外,是否有可能将安装在别人系统上的web3 (与依赖项)合并到我的系统中?
更新:我在当前的pc上安装了以下软件:
此外,我还可以在windows 7中安装web3 (该windows 7还有visual 2015),它执行/安装时没有任何错误。这是在尝试安装windows-build和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发布于 2019-02-08 10:59:17
不确定(因为您没有提供完整的错误日志),但我认为问题在于某些build-tools,安装它将解决您的问题。
npm install -g windows-build-tools注意:请确保全局安装
windows-build-tools。
发布于 2019-02-08 13:03:59
npm install --global --production windows-build-toolsnpm install --save --no-optional web3。希望这对你有用。
https://ethereum.stackexchange.com/questions/66704
复制相似问题