$ npm install -g truffle npm ERR! code EEXIST錯誤解決方法

 安個truffle折磨了我好幾天 今天終於安裝好了 翻了好多博客都沒找到答案 是我讀出錯信息解決的 由此可見 出錯信息還是不易忽視的

$ npm install -g truffle
npm ERR! code EEXIST
npm ERR! path E:\software\nn\node.js\node_global\node_modules\truffle\build\cli.bundled.js
npm ERR! dest E:\software\nn\node.js\node_global\truffle.cmd
npm ERR! EEXIST: file already exists, cmd shim 'E:\software\nn\node.js\node_global\node_modules\truffle\build\cli.bundled.js' -> 'E:\software\nn\node.js\node_global\truffle.cmd'
npm ERR! File exists: E:\software\nn\node.js\node_global\truffle.cmd
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

npm ERR! A complete log of this run can be found in:
npm ERR!     E:\software\nn\node.js\node_cache\_logs\2020-02-06T14_02_17_324Z-debug.log

(敲黑板)

以上錯誤是node_global文件下的truffle.cmd文件已經存在 需要刪除

$ npm install -g truffle
npm ERR! code EEXIST
npm ERR! path E:\software\nn\node.js\node_global\node_modules\truffle\build\cli.bundled.js
npm ERR! dest E:\software\nn\node.js\node_global\truffle
npm ERR! EEXIST: file already exists, cmd shim 'E:\software\nn\node.js\node_global\node_modules\truffle\build\cli.bundled.js' -> 'E:\software\nn\node.js\node_global\truffle'
npm ERR! File exists: E:\software\nn\node.js\node_global\truffle
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

npm ERR! A complete log of this run can be found in:
npm ERR!     E:\software\nn\node.js\node_cache\_logs\2020-02-07T07_24_49_045Z-debug.log

然後又出現

了新的錯誤 我都不知道爲什麼會有這麼多裝錯地方的文件

這個錯誤的意思是node_global文件下的truffle文件已經存在 需要刪除

$ npm install -g truffle
E:\software\nn\node.js\node_global\truffle -> E:\software\nn\node.js\node_global\node_modules\truffle\build\cli.bundled.js

> [email protected] postinstall E:\software\nn\node.js\node_global\node_modules\truffle
> node ./scripts/postinstall.js

- Fetching solc version list from solc-bin. Attempt #1
√ Downloading compiler. Attempt #1.
+ [email protected]
added 27 packages from 439 contributors in 361.036s

這樣就安裝成功了

別忘了檢驗一下

$ truffle -v
Truffle v5.1.12 - a development framework for Ethereum

Usage: truffle <command> [options]

Commands:
  build     Execute build pipeline (if configuration present)
  compile   Compile contract source files
  config    Set user-level configuration options
  console   Run a console with contract abstractions and commands available
  create    Helper to create new contracts, migrations and tests
  debug     Interactively debug any transaction on the blockchain (experimental)
  deploy    (alias for migrate)
  develop   Open a console with a local development blockchain
  exec      Execute a JS module within this Truffle environment
  help      List all commands or provide information about a specific command
  init      Initialize new and empty Ethereum project
  install   Install a package from the Ethereum Package Registry
  migrate   Run migrations to deploy contracts
  networks  Show addresses for deployed contracts on each network
  obtain    Fetch and cache a specified compiler
  opcode    Print the compiled opcodes for a given contract
  publish   Publish a package to the Ethereum Package Registry
  run       Run a third-party command
  test      Run JavaScript and Solidity tests
  unbox     Download a Truffle Box, a pre-built Truffle project
  version   Show version number and exit
  watch     Watch filesystem for changes and rebuild the project automatically

See more at http://truffleframework.com/docs

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章