簡體   English   中英

我在 windows 上安裝 Truffle 時出錯。有誰知道如何解決這個問題

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

這是我在通過nom -g install truffle時遇到的錯誤。 有人知道如何解決此問題並且在安裝 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

我找到了適合我的解決方案:

  • 安裝 node-gyp: npm install -g node-gyp
  • 清除 npm 緩存: npm cache clear --force
  • 最后點擊npm i -g truffle

如果它不起作用,請嘗試安裝它:

  • npm install --global windows-build-tools

順便說一句,我正在運行 Windows 10,節點 16.14.0 和 npm 8.3.1

Truffle 只兼容 npm < 7

你可以試試這個:

npm install -g npm@6

然后安裝松露

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM