简体   繁体   中英

I am getting an error while installing Truffle on windows. Does anyone know how to fix this

This is the error I was getting while installing truffle through nom -g install truffle . Does someone knows how to fix this issue and also got error after installing ganache

npm ERR! code 1
npm ERR! path C:\Users\Jaimin Bhatt\AppData\Roaming\npm\node_modules\truffle\node_modules\ganache\node_modules\secp256k1
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild
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@17.3.1 | win32 | x64
npm ERR! gyp info find Python using Python version 3.9.10 found at "C:\Users\Jaimin Bhatt\AppData\Local\Programs\Python\Python39\python.exe"
npm ERR! gyp http GET https://nodejs.org/download/release/v17.3.1/node-v17.3.1-headers.tar.gz
npm ERR! gyp http 200 https://nodejs.org/download/release/v17.3.1/node-v17.3.1-headers.tar.gz
npm ERR! gyp http GET https://nodejs.org/download/release/v17.3.1/SHASUMS256.txt
npm ERR! gyp http GET https://nodejs.org/download/release/v17.3.1/win-x86/node.lib
npm ERR! gyp http GET https://nodejs.org/download/release/v17.3.1/win-arm64/node.lib
npm ERR! gyp http GET https://nodejs.org/download/release/v17.3.1/win-x64/node.lib
npm ERR! gyp http 200 https://nodejs.org/download/release/v17.3.1/SHASUMS256.txt
npm ERR! gyp http 200 https://nodejs.org/download/release/v17.3.1/win-x86/node.lib
npm ERR! gyp http 200 https://nodejs.org/download/release/v17.3.1/win-x64/node.lib
npm ERR! gyp http 404 https://nodejs.org/download/release/v17.3.1/win-arm64/node.lib
npm ERR! gyp WARN install got an error, rolling back install
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: EBUSY: resource busy or locked, open 'C:\Users\Jaimin Bhatt\AppData\Local\node-gyp\Cache\17.3.1\x64\node.lib'
npm ERR! gyp ERR! System Windows_NT 10.0.22557
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Jaimin Bhatt\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\Jaimin Bhatt\AppData\Roaming\npm\node_modules\truffle\node_modules\ganache\node_modules\secp256k1
npm ERR! gyp ERR! node -v v17.3.1
npm ERR! gyp ERR! node-gyp -v v8.4.1
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Jaimin Bhatt\AppData\Local\npm-cache\_logs\2022-02-19T12_09_18_933Z-debug-0.log

I found a solution that worked for me:

  • Install node-gyp: npm install -g node-gyp
  • Clear npm cache: npm cache clear --force
  • Finally hit npm i -g truffle

If it does not work, try installing this also:

  • npm install --global windows-build-tools

By the way, Im running Windows 10, with Node 16.14.0 and npm 8.3.1

Truffle is only compatible with npm < 7

you can try this:

npm install -g npm@6

and then install truffle

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM