nodejs / node-gyp

Node.js native addon build tool
MIT License
9.91k stars 1.79k forks source link

Truffle Install Error #2631

Closed Punky278 closed 2 years ago

Punky278 commented 2 years ago

I am attempting to install truffle on VS Code using, npm install truffle -g, but I am getting these errors.

npm WARN deprecated mkdirp-promise@5.0.1: This package is broken and no longer maintained. 'mkdirp' itself supports promises now, please switch to that.  
npm WARN deprecated har-validator@5.1.5: this library is no longer supported 
npm WARN deprecated ipld-raw@6.0.0: This module has been superseded by the multiformats module
npm WARN deprecated circular-json@0.5.9: CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated cids@1.1.9: This module has been superseded by the multiformats module
npm WARN deprecated ipld-dag-cbor@0.17.1: This module has been superseded by @ipld/dag-cbor and multiformats
npm WARN deprecated multicodec@1.0.4: This module has been superseded by the multiformats module
npm WARN deprecated @nodefactory/filsnap-adapter@0.2.2: Package is deprecated in favour of @chainsafe/filsnap-adapter
npm WARN deprecated uuid@2.0.1: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated multibase@0.7.0: This module has been superseded by the multiformats module
npm WARN deprecated multibase@0.6.1: This module has been superseded by the multiformats module
npm WARN deprecated uuid@3.2.1: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid@3.2.1: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid@3.2.1: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid@3.3.2: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated multibase@4.0.6: This module has been superseded by the multiformats module
npm WARN deprecated multibase@4.0.6: This module has been superseded by the multiformats module
npm WARN deprecated multibase@4.0.6: This module has been superseded by the multiformats module
npm WARN deprecated multibase@3.1.2: This module has been superseded by the multiformats module
npm WARN deprecated mkdirp@0.5.1: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated multicodec@0.5.7: This module has been superseded by the multiformats module
npm WARN deprecated ipld-dag-pb@0.20.0: This module has been superseded by @ipld/dag-pb and multiformats
npm WARN deprecated multicodec@3.2.1: This module has been superseded by the multiformats module
npm WARN deprecated node-pre-gyp@0.11.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
npm WARN deprecated multicodec@2.1.3: This module has been superseded by the multiformats module
npm WARN deprecated multicodec@2.1.3: This module has been superseded by the multiformats module
npm WARN deprecated multicodec@2.1.3: This module has been superseded by the multiformats module
npm WARN deprecated axios@0.20.0: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410    
npm WARN deprecated cids@0.7.5: This module has been superseded by the multiformats module
npm WARN deprecated core-js@2.6.12: core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm WARN cleanup Failed to remove some directories [
npm WARN cleanup   [
npm WARN cleanup     'C:\\Users\\Dustin Smith\\AppData\\Roaming\\npm\\node_modules\\truffle\\node_modules\\ganache\\node_modules',
npm WARN cleanup     [Error: EBUSY: resource busy or locked, rmdir 'C:\Users\Dustin Smith\AppData\Roaming\npm\node_modules\truffle\node_modules\ganache\node_modules\keccak'] {
npm WARN cleanup       errno: -4082,
npm WARN cleanup       code: 'EBUSY',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'C:\\Users\\Dustin Smith\\AppData\\Roaming\\npm\\node_modules\\truffle\\node_modules\\ganache\\node_modules\\keccak'
npm WARN cleanup     }
npm WARN cleanup   ]
npm WARN cleanup ]
npm ERR! code 1
npm ERR! path C:\Users\Dustin Smith\AppData\Roaming\npm\node_modules\truffle\node_modules\ganache\node_modules\leveldown
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild       
npm ERR! Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
npm ERR!   builder.cc
npm ERR! C:\Users\Dustin Smith\AppData\Roaming\npm\node_modules\truffle\node_modules\ganache\node_modules\leveldown\deps\leveldb\port-libuv\port_uv.h(42,10): fatal error C1083: Cannot open include file: 'uv.h': No such file or directory [C:\Users\Dustin Smith\AppData\Roaming\npm\node_modules\truffle\node_modules\ganache\node_modules\leveldown\deps\leveldb\leveldb.vcxproj]
npm ERR!   snappy-sinksource.cc
npm ERR!   snappy-stubs-internal.cc
npm ERR!   snappy.cc
npm ERR!   win_delay_load_hook.cc
npm ERR!   snappy.vcxproj -> C:\Users\Dustin Smith\AppData\Roaming\npm\node_modules\truffle\node_modules\ganache\node_modules\leveldown\build\Release\\snappy.lib
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@8.4.1
npm ERR! gyp info using node@16.14.0 | win32 | x64
npm ERR! gyp info find Python using Python version 3.10.2 found at "C:\Python310\python.exe"
npm ERR! gyp info find VS using VS2019 (16.11.32126.315) found at:
npm ERR! gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
npm ERR! gyp info find VS run with --verbose for detailed information        
npm ERR! gyp info spawn C:\Python310\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   'C:\\Users\\Dustin Smith\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'msvs',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\Dustin Smith\\AppData\\Roaming\\npm\\node_modules\\truffle\\node_modules\\ganache\\node_modules\\leveldown\\build\\config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\Dustin Smith\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\Dustin Smith\\AppData\\Local\\node-gyp\\Cache\\16.14.0\\include\\node\\common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=C:\\Users\\Dustin Smith\\AppData\\Local\\node-gyp\\Cache\\16.14.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\Dustin Smith\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\Dustin Smith\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\16.14.0\\\\<(target_arch)\\\\node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\Dustin Smith\\AppData\\Roaming\\npm\\node_modules\\truffle\\node_modules\\ganache\\node_modules\\leveldown',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'C:\\Users\\Dustin Smith\\AppData\\Roaming\\npm\\node_modules\\truffle\\node_modules\\ganache\\node_modules\\leveldown\\build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   'build/binding.sln',
npm ERR! gyp info spawn args   '/clp:Verbosity=minimal',
npm ERR! gyp info spawn args   '/nologo',
npm ERR! gyp info spawn args   '/p:Configuration=Release;Platform=x64'       
npm ERR! gyp info spawn args ]
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1  
npm ERR! gyp ERR! stack     at ChildProcess.onExit (C:\Users\Dustin Smith\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23) 
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:520:28)        
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Windows_NT 10.0.22000
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Dustin Smith\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\Dustin Smith\AppData\Roaming\npm\node_modules\truffle\node_modules\ganache\node_modules\leveldown
npm ERR! gyp ERR! node -v v16.14.0
npm ERR! gyp ERR! node-gyp -v v8.4.1
npm ERR! gyp ERR! not ok

Any help would be greatly appreciated.

NicoMartinic commented 2 years ago

I had the same problem. Then i watched and follow this video : https://www.youtube.com/watch?v=p6gsIm1xUEM And then in the cmd put npm i truffle -g and worked. Hope it works for you too.

rvagg commented 2 years ago

it could be the space in the username - Dustin Smith, there's regularly random issues with spaces in path names on Windows, and although I'd assume by default that we've dealt with them all, it's entirely possible that we've not for some particular permutation. Maybe install it elsewhere. It looks like you're doing a -g for this because it's trying to get into the global directory, but maybe remove that and install it locally to some working directory that doesn't have a space in the name. See also https://docs.npmjs.com/cli/v8/configuring-npm/folders for info about global vs local.

nilsriga commented 2 years ago

I get

this on windows terminal, powershel, and cmd

npm ERR! code 127
npm ERR! path C:\Users\user\AppData\Roaming\npm\node_modules\truffle\node_modules\bufferutil
npm ERR! command failed
npm ERR! command bash -c node-gyp-build
npm ERR! /mnt/c/Users/user/AppData/Roaming/npm/node_modules/truffle/node_modules/bufferutil/node_modules/.bin/node-gyp-build: 11: exec: node: not found

and

....

npm timing build:link:node_modules/truffle/node_modules/sshpk Completed in 210ms
npm timing build:link:node_modules/truffle/node_modules/uuid Completed in 209ms
npm timing build:link:node_modules/truffle/node_modules/which Completed in 210ms
npm timing build:link:node_modules/truffle/node_modules/xss Completed in 209ms
npm timing build:link:node_modules/truffle/node_modules/bufferutil/node_modules/node-gyp-build Completed in 209ms
npm timing build:link:node_modules/truffle/node_modules/keccak/node_modules/node-gyp-build Completed in 208ms
npm timing build:link:node_modules/truffle/node_modules/secp256k1/node_modules/node-gyp-build Completed in 204ms
npm timing build:link:node_modules/truffle/node_modules/utf-8-validate/node_modules/node-gyp-build Completed in 204ms
npm timing build:link:node_modules/truffle Completed in 232ms
npm timing build:link Completed in 234ms
npm info run bufferutil@4.0.6 install node_modules/truffle/node_modules/bufferutil node-gyp-build
npm info run iso-constants@0.1.2 install node_modules/truffle/node_modules/iso-constants node build.js > index.browser.js
npm info run keccak@3.0.2 install node_modules/truffle/node_modules/keccak node-gyp-build || exit 0
npm info run leveldown@5.0.2 install node_modules/truffle/node_modules/leveldown node-gyp-build
npm info run iso-constants@0.1.2 install { code: 0, signal: null }
npm timing build:run:install:node_modules/truffle/node_modules/iso-constants Completed in 503ms
npm info run secp256k1@4.0.3 install node_modules/truffle/node_modules/secp256k1 node-gyp-build || exit 0
npm info run keccak@3.0.2 install { code: 0, signal: null }
npm timing build:run:install:node_modules/truffle/node_modules/keccak Completed in 1278ms
npm info run sqlite3@4.2.0 install node_modules/truffle/node_modules/sqlite3 node-pre-gyp install --fallback-to-build
npm info run leveldown@5.0.2 install { code: 0, signal: null }
npm timing build:run:install:node_modules/truffle/node_modules/leveldown Completed in 1298ms
npm info run tiny-secp256k1@1.1.6 install node_modules/truffle/node_modules/tiny-secp256k1 npm run build || echo "secp256k1 bindings compilation fail. Pure JS implementation will be used."
npm info run bufferutil@4.0.6 install { code: 0, signal: null }
npm timing build:run:install:node_modules/truffle/node_modules/bufferutil Completed in 1442ms
npm info run ursa-optional@0.10.2 install node_modules/truffle/node_modules/ursa-optional node rebuild.js
npm info run secp256k1@4.0.3 install { code: 0, signal: null }
npm timing build:run:install:node_modules/truffle/node_modules/secp256k1 Completed in 1616ms
npm info run utf-8-validate@5.0.9 install node_modules/truffle/node_modules/utf-8-validate node-gyp-build
npm info run utf-8-validate@5.0.9 install { code: 0, signal: null }
npm timing build:run:install:node_modules/truffle/node_modules/utf-8-validate Completed in 2506ms
npm info run @trufflesuite/bigint-buffer@1.1.9 install node_modules/truffle/node_modules/ganache/node_modules/@trufflesuite/bigint-buffer node-gyp rebuild
npm info run sqlite3@4.2.0 install { code: 1, signal: null }
npm verb reify failed optional dependency C:\Users\user\AppData\Roaming\npm\node_modules\truffle\node_modules\sqlite3
npm verb reify failed optional dependency C:\Users\user\AppData\Roaming\npm\node_modules\truffle\node_modules\websql
npm verb reify failed optional dependency C:\Users\user\AppData\Roaming\npm\node_modules\truffle\node_modules\pouchdb-adapter-node-websql
npm verb reify failed optional dependency C:\Users\user\AppData\Roaming\npm\node_modules\truffle\node_modules\@truffle\db
npm verb reify failed optional dependency C:\Users\user\AppData\Roaming\npm\node_modules\truffle\node_modules\node-pre-gyp
npm verb reify failed optional dependency C:\Users\user\AppData\Roaming\npm\node_modules\truffle\node_modules\argsarray
npm verb reify failed optional dependency C:\Users\user\AppData\Roaming\npm\node_modules\truffle\node_modules\immediate

...

npm verb reify failed optional dependency C:\Users\user\AppData\Roaming\npm\node_modules\truffle\node_modules\ethers\node_modules\inherits
npm verb reify failed optional dependency C:\Users\user\AppData\Roaming\npm\node_modules\truffle\node_modules\pkg-up\node_modules\p-locate
npm verb reify failed optional dependency C:\Users\user\AppData\Roaming\npm\node_modules\truffle\node_modules\p-try
npm verb reify failed optional dependency C:\Users\user\AppData\Roaming\npm\node_modules\truffle\node_modules\encoding-down\node_modules\level-concat-iterator
npm verb reify failed optional dependency C:\Users\user\AppData\Roaming\npm\node_modules\truffle\node_modules\encoding-down\node_modules\level-supports
npm verb reify failed optional dependency C:\Users\user\AppData\Roaming\npm\node_modules\truffle\node_modules\level-packager\node_modules\abstract-leveldown
npm verb reify failed optional dependency C:\Users\user\AppData\Roaming\npm\node_modules\truffle\node_modules\level-packager\node_modules\inherits
npm verb reify failed optional dependency C:\Users\user\AppData\Roaming\npm\node_modules\truffle\node_modules\pouchdb-adapter-leveldb-core\node_modules\level-concat-iterator
npm verb reify failed optional dependency C:\Users\user\AppData\Roaming\npm\node_modules\truffle\node_modules\ora\node_modules\color-name
npm verb reify failed optional dependency C:\Users\user\AppData\Roaming\npm\node_modules\truffle\node_modules\restore-cursor\node_modules\mimic-fn
npm verb reify failed optional dependency C:\Users\user\AppData\Roaming\npm\node_modules\truffle\node_modules\pkg-up\node_modules\p-limit
npm verb reify failed optional dependency C:\Users\user\AppData\Roaming\npm\node_modules\truffle\node_modules\level-packager\node_modules\level-concat-iterator
npm verb reify failed optional dependency C:\Users\user\AppData\Roaming\npm\node_modules\truffle\node_modules\pkg-up\node_modules\p-try
npm timing build:run:install:node_modules/truffle/node_modules/sqlite3 Completed in 8957ms
npm info run bufferutil@4.0.5 install node_modules/truffle/node_modules/ganache/node_modules/bufferutil node-gyp rebuild
npm info run ursa-optional@0.10.2 install { code: 0, signal: null }
npm timing build:run:install:node_modules/truffle/node_modules/ursa-optional Completed in 8853ms
npm info run keccak@3.0.1 install node_modules/truffle/node_modules/ganache/node_modules/keccak node-gyp rebuild
npm info run tiny-secp256k1@1.1.6 install { code: 0, signal: null }
npm timing build:run:install:node_modules/truffle/node_modules/tiny-secp256k1 Completed in 11406ms
npm info run leveldown@6.1.0 install node_modules/truffle/node_modules/ganache/node_modules/leveldown node-gyp rebuild
npm info run keccak@3.0.1 install { code: 1, signal: null }
npm info run @trufflesuite/bigint-buffer@1.1.9 install { code: 0, signal: null }
npm timing build:run:install:node_modules/truffle/node_modules/ganache/node_modules/@trufflesuite/bigint-buffer Completed in 12122ms
npm info run secp256k1@4.0.2 install node_modules/truffle/node_modules/ganache/node_modules/secp256k1 node-gyp rebuild
npm info run leveldown@6.1.0 install { code: 1, signal: null }
npm info run bufferutil@4.0.5 install { code: 0, signal: null }
npm timing build:run:install:node_modules/truffle/node_modules/ganache/node_modules/bufferutil Completed in 18256ms
npm info run utf-8-validate@5.0.7 install node_modules/truffle/node_modules/ganache/node_modules/utf-8-validate node-gyp rebuild
npm info run utf-8-validate@5.0.7 install { code: 'ENOENT', signal: undefined }
npm verb reify failed optional dependency C:\Users\user\AppData\Roaming\npm\node_modules\truffle\node_modules\ganache\node_modules\utf-8-validate
npm timing build:run:install:node_modules/truffle/node_modules/ganache/node_modules/utf-8-validate Completed in 11ms
npm info run secp256k1@4.0.2 install { code: 1, signal: null }
npm timing reify:rollback:createSparse Completed in 16065ms
npm timing reify:rollback:retireShallow Completed in 0ms
npm timing command:install Completed in 143328ms
npm verb stack Error: command failed
npm verb stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\promise-spawn\index.js:64:27)
npm verb stack     at ChildProcess.emit (node:events:527:28)
npm verb stack     at maybeClose (node:internal/child_process:1090:16)
npm verb stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
npm verb pkgid keccak@3.0.1
npm verb cwd C:\Users\user
npm verb Windows_NT 10.0.18363
npm verb argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "truffle" "--loglevel" "verbose"
npm verb node v17.7.1
npm verb npm  v8.5.2
npm ERR! code 1
npm ERR! path C:\Users\user\AppData\Roaming\npm\node_modules\truffle\node_modules\ganache\node_modules\keccak
npm ERR! command failed
npm ERR! command bash -c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli   'C:\\Program Files\\nodejs\\node.exe',
npm ERR! gyp verb cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js',
npm ERR! gyp verb cli   'rebuild'
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@8.4.1
npm ERR! gyp info using node@17.7.1 | win32 | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb find Python Python is not set from command line or npm configuration
npm ERR! gyp verb find Python Python is not set from environment variable PYTHON
npm ERR! gyp verb find Python checking if "python3" can be used
npm ERR! gyp verb find Python - executing "python3" to get executable path
npm ERR! gyp verb find Python - "python3" is not in PATH or produced an error
npm ERR! gyp verb find Python checking if "python" can be used
npm ERR! gyp verb find Python - executing "python" to get executable path
npm ERR! gyp verb find Python - executable path is "C:\Python310\python.exe"
npm ERR! gyp verb find Python - executing "C:\Python310\python.exe" to get version
npm ERR! gyp verb find Python - version is "3.10.3"
npm ERR! gyp info find Python using Python version 3.10.3 found at "C:\Python310\python.exe"
npm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 17.7.1
npm ERR! gyp verb command install [ '17.7.1' ]
npm ERR! gyp verb install input version string "17.7.1"
npm ERR! gyp verb install installing version: 17.7.1
npm ERR! gyp verb install --ensure was passed, so won't reinstall if already installed
npm ERR! gyp verb install version is already installed, need to check "installVersion"
npm ERR! gyp verb got "installVersion" 9
npm ERR! gyp verb needs "installVersion" 9
npm ERR! gyp verb install version is good
npm ERR! gyp verb get node dir target node version installed: 17.7.1
npm ERR! gyp verb build dir attempting to create "build" dir: C:\Users\user\AppData\Roaming\npm\node_modules\truffle\node_modules\ganache\node_modules\keccak\build
npm ERR! gyp verb build dir "build" dir needed to be created? Yes
npm ERR! gyp verb find VS msvs_version not set from command line or npm config
npm ERR! gyp verb find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp verb find VS checking VS2022 (17.1.32210.238) found at:
npm ERR! gyp verb find VS "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools"
npm ERR! gyp verb find VS - found "Visual Studio C++ core features"
npm ERR! gyp verb find VS - missing any VC++ toolset
npm ERR! gyp verb find VS checking VS2019 (16.11.32126.315) found at:
npm ERR! gyp verb find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
npm ERR! gyp verb find VS - found "Visual Studio C++ core features"
npm ERR! gyp verb find VS - found VC++ toolset: v142
npm ERR! gyp verb find VS - found Windows SDK: 10.0.19041.0
npm ERR! gyp info find VS using VS2019 (16.11.32126.315) found at:
npm ERR! gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
npm ERR! gyp info find VS run with --verbose for detailed information
npm ERR! gyp verb build/config.gypi creating config file
npm ERR! gyp verb build/config.gypi writing out config file: C:\Users\user\AppData\Roaming\npm\node_modules\truffle\node_modules\ganache\node_modules\keccak\build\config.gypi
npm ERR! gyp verb config.gypi checking for gypi file: C:\Users\user\AppData\Roaming\npm\node_modules\truffle\node_modules\ganache\node_modules\keccak\config.gypi
npm ERR! gyp verb common.gypi checking for gypi file: C:\Users\user\AppData\Roaming\npm\node_modules\truffle\node_modules\ganache\node_modules\keccak\common.gypi
npm ERR! gyp verb gyp gyp format was not specified; forcing "msvs"
npm ERR! gyp info spawn C:\Python310\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'msvs',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\truffle\\node_modules\\ganache\\node_modules\\keccak\\build\\config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\user\\AppData\\Local\\node-gyp\\Cache\\17.7.1\\include\\node\\common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=C:\\Users\\user\\AppData\\Local\\node-gyp\\Cache\\17.7.1',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\user\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\17.7.1\\\\<(target_arch)\\\\node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\truffle\\node_modules\\ganache\\node_modules\\keccak',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\truffle\\node_modules\\ganache\\node_modules\\keccak\\build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! The system cannot find the path specified.
npm ERR! gyp: Call to 'node -p "process.arch"' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:259:16)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Windows_NT 10.0.18363
npm ERR! 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"
npm ERR! gyp ERR! cwd C:\Users\user\AppData\Roaming\npm\node_modules\truffle\node_modules\ganache\node_modules\keccak
npm ERR! gyp ERR! node -v v17.7.1
npm ERR! gyp ERR! node-gyp -v v8.4.1
npm ERR! gyp ERR! not ok
npm verb exit 1
npm timing npm Completed in 144175ms
npm verb unfinished npm timer reify 1647550606483
npm verb unfinished npm timer reify:build 1647550716990
npm verb unfinished npm timer build 1647550716995
npm verb unfinished npm timer build:deps 1647550716997
npm verb unfinished npm timer build:run:install 1647550717361
npm verb unfinished npm timer build:run:install:node_modules/truffle/node_modules/ganache/node_modules/keccak 1647550727657
npm verb unfinished npm timer build:run:install:node_modules/truffle/node_modules/ganache/node_modules/leveldown 1647550730106
npm verb unfinished npm timer build:run:install:node_modules/truffle/node_modules/ganache/node_modules/secp256k1 1647550734129
npm verb code 1

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\user\AppData\Local\npm-cache\_logs\2022-03-17T20_56_45_650Z-debug-0.log

Tried with nvm, with turning it off. Reinstalling node, npm, python, with pyenv and without. All of this with using an .exe file, pip or choco. no progress. Now everything has the latest versions.

nilsriga commented 2 years ago

I guess I'll try reinstalling those Visual Studio 2017 tools now..

nilsriga commented 2 years ago

Ok. Installed them all and we have progress:

As an admin, the git bash for windows terminal get's stuck at

npm info run windows-build-tools@5.2.2 postinstall node_modules/windows-build-tools node ./dist/index.js

but running it normally got me that this command:

 "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"

is the one which is failing the show with:

gyp info it worked if it ends with ok
gyp info using node-gyp@8.4.1
gyp info using node@17.7.1 | win32 | x64
gyp info find Python using Python version 3.10.3 found at "C:\Python310\python.exe"
gyp info find VS using VS2019 (16.11.32126.315) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
gyp info find VS run with --verbose for detailed information
gyp info spawn C:\Python310\python.exe
gyp info spawn args [
gyp info spawn args   'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\user\\.windows-build-tools\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\user\\AppData\\Local\\node-gyp\\Cache\\17.7.1\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\user\\AppData\\Local\\node-gyp\\Cache\\17.7.1',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\user\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\17.7.1\\\\<(target_arch)\\\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\user\\.windows-build-tools',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'C:\\Users\\user\\.windows-build-tools\\build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp: binding.gyp not found (cwd: C:\Users\user\.windows-build-tools) while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:259:16)
gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Windows_NT 10.0.18363
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 C:\Users\user\.windows-build-tools
gyp ERR! node -v v17.7.1
gyp ERR! node-gyp -v v8.4.1
gyp ERR! not ok

so...

binding.gyp not found (cwd: C:\Users\user\.windows-build-tools) while trying to load binding.gyp

what's that?

nilsriga commented 2 years ago

Tried another computer. First time install of npm and node. Still the same error

nilsriga commented 2 years ago

Got it working on WSL2 with

sudo npm install -g truffle --unsafe-perm
kuznetsov-m commented 2 years ago

have same problem macOS 11.6 node v18.2.0 npm 8.10.0 zsh

instalation log:

 ✘ user@MacBook-Pro-13  ~  sudo npm install -g truffle --unsafe-perm
Password:
npm WARN deprecated mkdirp-promise@5.0.1: This package is broken and no longer maintained. 'mkdirp' itself supports promises now, please switch to that.
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated ipld-raw@6.0.0: This module has been superseded by the multiformats module
npm WARN deprecated @nodefactory/filsnap-adapter@0.2.2: Package is deprecated in favour of @chainsafe/filsnap-adapter
npm WARN deprecated cids@1.1.9: This module has been superseded by the multiformats module
npm WARN deprecated uuid@2.0.1: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated multicodec@1.0.4: This module has been superseded by the multiformats module
npm WARN deprecated uuid@3.2.1: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid@3.2.1: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid@3.3.2: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated ipld-dag-cbor@0.17.1: This module has been superseded by @ipld/dag-cbor and multiformats
npm WARN deprecated multibase@4.0.6: This module has been superseded by the multiformats module
npm WARN deprecated multibase@4.0.6: This module has been superseded by the multiformats module
npm WARN deprecated multibase@4.0.6: This module has been superseded by the multiformats module
npm WARN deprecated multibase@3.1.2: This module has been superseded by the multiformats module
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated multibase@0.6.1: This module has been superseded by the multiformats module
npm WARN deprecated multibase@0.7.0: This module has been superseded by the multiformats module
npm WARN deprecated multicodec@0.5.7: This module has been superseded by the multiformats module
npm WARN deprecated ipld-dag-pb@0.20.0: This module has been superseded by @ipld/dag-pb and multiformats
npm WARN deprecated multicodec@3.2.1: This module has been superseded by the multiformats module
npm WARN deprecated node-pre-gyp@0.11.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
npm WARN deprecated multicodec@2.1.3: This module has been superseded by the multiformats module
npm WARN deprecated multicodec@2.1.3: This module has been superseded by the multiformats module
npm WARN deprecated multicodec@2.1.3: This module has been superseded by the multiformats module
npm WARN deprecated cids@0.7.5: This module has been superseded by the multiformats module
npm WARN cleanup Failed to remove some directories [
npm WARN cleanup   [
npm WARN cleanup     '/usr/local/lib/node_modules/truffle/node_modules/ganache/node_modules',
npm WARN cleanup     [Error: EINVAL: invalid argument, rmdir '/usr/local/lib/node_modules/truffle/node_modules/ganache/node_modules'] {
npm WARN cleanup       errno: -22,
npm WARN cleanup       code: 'EINVAL',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: '/usr/local/lib/node_modules/truffle/node_modules/ganache/node_modules'
npm WARN cleanup     }
npm WARN cleanup   ]
npm WARN cleanup ]
npm ERR! code 1
npm ERR! path /usr/local/lib/node_modules/truffle/node_modules/ganache/node_modules/leveldown
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! CXX(target) Release/obj.target/leveldb/deps/leveldb/leveldb-1.20/db/builder.o
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.0.0
npm ERR! gyp info using node@18.2.0 | darwin | x64
npm ERR! gyp info find Python using Python version 3.8.1 found at "/Library/Frameworks/Python.framework/Versions/3.8/bin/python3"
npm ERR! gyp info spawn /Library/Frameworks/Python.framework/Versions/3.8/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/truffle/node_modules/ganache/node_modules/leveldown/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/user/Library/Caches/node-gyp/18.2.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/Users/user/Library/Caches/node-gyp/18.2.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/Users/user/Library/Caches/node-gyp/18.2.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/usr/local/lib/node_modules/truffle/node_modules/ganache/node_modules/leveldown',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! In file included from ../deps/leveldb/leveldb-1.20/db/builder.cc:5:
npm ERR! In file included from ../deps/leveldb/leveldb-1.20/db/builder.h:8:
npm ERR! In file included from ../deps/leveldb/leveldb-1.20/include/leveldb/status.h:16:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:504:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string_view:175:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__string:56:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:641:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:60:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string.h:60:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/string.h:61:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_types.h:27:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:32:
npm ERR! /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:807:2: error: Unsupported architecture
npm ERR! #error Unsupported architecture
npm ERR!  ^
npm ERR! In file included from ../deps/leveldb/leveldb-1.20/db/builder.cc:5:
npm ERR! In file included from ../deps/leveldb/leveldb-1.20/db/builder.h:8:
npm ERR! In file included from ../deps/leveldb/leveldb-1.20/include/leveldb/status.h:16:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:504:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string_view:175:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__string:56:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:641:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:60:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string.h:60:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/string.h:61:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_types.h:27:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:33:
npm ERR! /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/machine/_types.h:34:2: error: architecture not supported
npm ERR! #error architecture not supported
npm ERR!  ^
npm ERR! In file included from ../deps/leveldb/leveldb-1.20/db/builder.cc:5:
npm ERR! In file included from ../deps/leveldb/leveldb-1.20/db/builder.h:8:
npm ERR! In file included from ../deps/leveldb/leveldb-1.20/include/leveldb/status.h:16:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:504:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string_view:175:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__string:56:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:641:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:60:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string.h:60:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/string.h:61:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_types.h:27:
npm ERR! /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:55:9: error: unknown type name '__int64_t'
npm ERR! typedef __int64_t       __darwin_blkcnt_t;      /* total blocks */
npm ERR!         ^
npm ERR! /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:56:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?
npm ERR! typedef __int32_t       __darwin_blksize_t;     /* preferred block size */
npm ERR!         ^
npm ERR! note: '__int128_t' declared here
npm ERR! /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:57:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?
npm ERR! typedef __int32_t       __darwin_dev_t;         /* dev_t */
npm ERR!         ^
npm ERR! note: '__int128_t' declared here
npm ERR! /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:60:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
npm ERR! typedef __uint32_t      __darwin_gid_t;         /* [???] process and group IDs */
npm ERR!         ^
npm ERR! note: '__uint128_t' declared here
npm ERR! /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:61:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
npm ERR! typedef __uint32_t      __darwin_id_t;          /* [XSI] pid_t, uid_t, or gid_t*/
npm ERR!         ^
npm ERR! note: '__uint128_t' declared here
npm ERR! /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:62:9: error: unknown type name '__uint64_t'
npm ERR! typedef __uint64_t      __darwin_ino64_t;       /* [???] Used for 64 bit inodes */
npm ERR!         ^
npm ERR! /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:68:9: error: unknown type name '__darwin_natural_t'
npm ERR! typedef __darwin_natural_t __darwin_mach_port_name_t; /* Used by mach */
npm ERR!         ^
npm ERR! /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:70:9: error: unknown type name '__uint16_t'; did you mean '__uint128_t'?
npm ERR! typedef __uint16_t      __darwin_mode_t;        /* [???] Some file attributes */
npm ERR!         ^
npm ERR! note: '__uint128_t' declared here
npm ERR! /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:71:9: error: unknown type name '__int64_t'
npm ERR! typedef __int64_t       __darwin_off_t;         /* [???] Used for file sizes */
npm ERR!         ^
npm ERR! /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:72:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?
npm ERR! typedef __int32_t       __darwin_pid_t;         /* [???] process and group IDs */
npm ERR!         ^
npm ERR! note: '__int128_t' declared here
npm ERR! /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:73:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
npm ERR! typedef __uint32_t      __darwin_sigset_t;      /* [???] signal set */
npm ERR!         ^
npm ERR! note: '__uint128_t' declared here
npm ERR! /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:74:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?
npm ERR! typedef __int32_t       __darwin_suseconds_t;   /* [???] microseconds */
npm ERR!         ^
npm ERR! note: '__int128_t' declared here
npm ERR! /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:75:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
npm ERR! typedef __uint32_t      __darwin_uid_t;         /* [???] user IDs */
npm ERR!         ^
npm ERR! note: '__uint128_t' declared here
npm ERR! /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types.h:76:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
npm ERR! typedef __uint32_t      __darwin_useconds_t;    /* [???] microseconds */
npm ERR!         ^
npm ERR! note: '__uint128_t' declared here
npm ERR! In file included from ../deps/leveldb/leveldb-1.20/db/builder.cc:5:
npm ERR! In file included from ../deps/leveldb/leveldb-1.20/db/builder.h:8:
npm ERR! In file included from ../deps/leveldb/leveldb-1.20/include/leveldb/status.h:16:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:504:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string_view:175:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__string:56:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:641:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:60:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string.h:60:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/string.h:61:
npm ERR! /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_types.h:43:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
npm ERR! typedef __uint32_t      __darwin_wctype_t;
npm ERR!         ^
npm ERR! note: '__uint128_t' declared here
npm ERR! In file included from ../deps/leveldb/leveldb-1.20/db/builder.cc:5:
npm ERR! In file included from ../deps/leveldb/leveldb-1.20/db/builder.h:8:
npm ERR! In file included from ../deps/leveldb/leveldb-1.20/include/leveldb/status.h:16:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:504:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string_view:175:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__string:56:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:641:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:60:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string.h:60:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/string.h:141:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_rsize_t.h:30:
npm ERR! /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/machine/types.h:37:2: error: architecture not supported
npm ERR! #error architecture not supported
npm ERR!  ^
npm ERR! In file included from ../deps/leveldb/leveldb-1.20/db/builder.cc:5:
npm ERR! In file included from ../deps/leveldb/leveldb-1.20/db/builder.h:8:
npm ERR! In file included from ../deps/leveldb/leveldb-1.20/include/leveldb/status.h:16:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:504:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string_view:175:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__string:56:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:641:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:60:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string.h:60:
npm ERR! In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/string.h:141:
npm ERR! /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_types/_rsize_t.h:31:9: error: unknown type name '__darwin_size_t'
npm ERR! typedef __darwin_size_t        rsize_t;
npm ERR!         ^
npm ERR! fatal error: too many errors emitted, stopping now [-ferror-limit=]
npm ERR! 20 errors generated.
npm ERR! make: *** [Release/obj.target/leveldb/deps/leveldb/leveldb-1.20/db/builder.o] Error 1
npm ERR! gyp ERR! build error 
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Darwin 20.6.0
npm ERR! gyp ERR! command "/usr/local/Cellar/node/18.2.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /usr/local/lib/node_modules/truffle/node_modules/ganache/node_modules/leveldown
npm ERR! gyp ERR! node -v v18.2.0
npm ERR! gyp ERR! node-gyp -v v9.0.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/user/.npm/_logs/2022-05-20T14_59_18_262Z-debug-0.log
cclauss commented 2 years ago

The others were Windows but @kuznetsov-m, you are macOS and you have the message.

npm ERR! #error architecture not supported

Are you on Apple Silicon? Please try running: sw_vers ; uname -m You might need to update Xcode

kuznetsov-m commented 2 years ago

@cclauss, You are right, maybe I have a different problem. Should I open a new issue? mbp 2018

sw_vers ; uname -m

ProductName:    macOS
ProductVersion: 11.6
BuildVersion:   20G165
x86_64
cclauss commented 2 years ago

OK. You are on Intel, not Apple Silicon. The next step would be for you to go to Apple menu / App Store / Develop and ensure that Xcode is up-to-date.

kuznetsov-m commented 2 years ago

My problem was in the old version of Xcode (11). The App Store has been asking me to update Xcode for a long time, but it also required me to update mac OS. I didn't want to update the OS. I completely reinstalled Xcode and now I have Xcode 13.2.1. Truffle was successfully installed with the command: npm install -g truffle @cclauss thanks a lot of support!

cclauss commented 2 years ago

Awesome. Please close this issue.

kuznetsov-m commented 2 years ago

Unfortunately, I can't to do this. I am not the author of this issue.

kuznetsov-m commented 2 years ago

One more question about truffle instalation Why is truffle not listed in npm packages?

 user@MacBook-Pro-13 ~ truffle version
Truffle v5.5.15 (core: 5.5.15)
Ganache v^7.1.0
Solidity v0.5.16 (solc-js)
Node v18.2.0
Web3.js v1.5.3
 user@MacBook-Pro-13 ~ npm list
/Users/user
└── (empty)
TrejGun commented 2 years ago

@cclauss @kuznetsov-m the problem is not only in XCode. I have the same issue in GH actions

cclauss commented 2 years ago

Please provide a link to the failing Action.

TrejGun commented 2 years ago
Screen Shot 2022-06-25 at 16 03 00

This is how it looks in GH, not wholly identical but on the local machine looks exactly like @kuznetsov-m posted above

This repo is private so I can give you access if you like

Btw I have to admit I can't reproduce this error anymore on my new mac which has no XCode installed

TrejGun commented 2 years ago

Looks like I can't prove it is the same( I will add more info when I have

cclauss commented 2 years ago

Looks like you need to install https://www.npmjs.com/package/ganache

TrejGun commented 2 years ago

Yeah but that does not help)

cclauss commented 2 years ago

On macOS just brew install truffle