Truffle

無法升級松露

  • October 11, 2020

我正在嘗試在 Ubuntu 18.04 上更新 Truffle。我目前在我的系統上安裝了 5.1.33 版的 Truffle。

u/lc2530hz:~$ truffle version 您可以通過在項目 Truffle v5.1.33 (core: 5.1.33) Solidity v0.5.16 中安裝(已棄用的)scrypt 包來提高 web3 在執行早於 10.5.0 的 Node.js 版本時的性能(solc-js) 節點 v8.10.0 Web3.js v1.2.1

我收到以下錯誤消息:

u/lc2530hz:~$ sudo npm install -g truffle
[sudo] password for
loadDep:original-require ▄ ╢██████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine mocha@8.1.2: wanted: {"node":">= 10.12.0"} (current: {"node":"8.10.0loadDep:yargs-unparser → ▐ ╢█████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine log-symbols@4.0.0: wanted: {"node":">=10"} (current: {"node":"8.10.0loadDep:yargs-unparser → ▐ ╢█████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine escape-string-regexp@4.0.0: wanted: {"node":">=10"} (current: {"nodeloadDep:yargs-unparser → ▄ ╢█████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine find-up@5.0.0: wanted: {"node":">=10"} (current: {"node":"8.10.0","nloadDep:fsevents → addNam ▄ ╢█████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine fsevents@2.1.3: wanted: {"node":"^8.16.0 || ^10.6.0 || >=11.0.0"} (cloadDep:path-exists → 304 ▀ ╢██████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine locate-path@6.0.0: wanted: {"node":">=10"} (current: {"node":"8.10.0loadDep:p-locate → reques ▀ ╢██████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine p-locate@5.0.0: wanted: {"node":">=10"} (current: {"node":"8.10.0","loadDep:p-limit → 304 ▐ ╢██████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine p-limit@3.0.2: wanted: {"node":">=10"} (current: {"node":"8.10.0","nloadDep:chalk → request ▐ ╢██████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine chalk@4.1.0: wanted: {"node":">=10"} (current: {"node":"8.10.0","npmnpm ERR! Linux 4.15.0-112-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "truffle"
npm ERR! node v8.10.0
npm ERR! npm v3.5.2
npm ERR! code EMISSINGARG
npm ERR! typeerror Error: Missing required argument #1
npm ERR! typeerror at andLogAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:31:3)
npm ERR! typeerror at fetchPackageMetadata (/usr/share/npm/lib/fetch-package-metadata.js:51:22)
npm ERR! typeerror at resolveWithNewModule (/usr/share/npm/lib/install/deps.js:456:12)
npm ERR! typeerror at /usr/share/npm/lib/install/deps.js:457:7
npm ERR! typeerror at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror at /usr/share/npm/lib/fetch-package-metadata.js:37:12
npm ERR! typeerror at addRequestedAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:82:5)
npm ERR! typeerror at returnAndAddMetadata (/usr/share/npm/lib/fetch-package-metadata.js:117:7)
npm ERR! typeerror at pickVersionFromRegistryDocument (/usr/share/npm/lib/fetch-package-metadata.js:134:20)
npm ERR! typeerror at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror This is an error with npm itself. Please report this error at:
npm ERR! typeerror http://github.com/npm/npm/issues
npm ERR! Please include the following file with any support request:
npm ERR! /home/username/npm-debug.log

There is no change in my version:

u/lc2530hz:~$ truffle version
You can improve web3's peformance when running Node.js versions older than 10.5.0 by installing the (deprecated) scrypt package in your project
Truffle v5.1.33 (core: 5.1.33)
Solidity v0.5.16 (solc-js)
Node v8.10.0
Web3.js v1.2.1
u/lc2530hz:~$

Somebody please guide me.
Zulfi.

抱歉,解除安裝命令不起作用:

@lc2530hz:~$ npm uninstall -g truffle
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/truffle/node_modules/app-module-path
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/truffle/node_modules/browser-stdout
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/truffle/node_modules/balanced-match
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/truffle/node_modules/commander
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/truffle/node_modules/concat-map
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/truffle/node_modules/diff
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/truffle/node_modules/escape-string-regexp
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/truffle/node_modules/brace-expansion
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/truffle/node_modules/fs.realpath
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/truffle/node_modules/growl
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/truffle/node_modules/has-flag
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/truffle/node_modules/he
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/truffle/node_modules/inherits
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/truffle/node_modules/minimatch
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/truffle/node_modules/minimist
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/truffle/node_modules/mkdirp
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/truffle/node_modules/ms
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/truffle/node_modules/debug
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/truffle/node_modules/original-require
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/truffle/node_modules/path-is-absolute
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/truffle/node_modules/supports-color
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/truffle/node_modules/wrappy
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/truffle/node_modules/once
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/truffle/node_modules/inflight
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/truffle/node_modules/mocha
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/truffle/node_modules/glob
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/truffle
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/truffle/node_modules
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
- app-module-path@2.2.0 node_modules/truffle/node_modules/app-module-path
- balanced-match@1.0.0 node_modules/truffle/node_modules/balanced-match
- browser-stdout@1.3.1 node_modules/truffle/node_modules/browser-stdout
- commander@2.15.1 node_modules/truffle/node_modules/commander
- concat-map@0.0.1 node_modules/truffle/node_modules/concat-map
- brace-expansion@1.1.11 node_modules/truffle/node_modules/brace-expansion
- diff@3.5.0 node_modules/truffle/node_modules/diff
- escape-string-regexp@1.0.5 node_modules/truffle/node_modules/escape-string-regexp
- fs.realpath@1.0.0 node_modules/truffle/node_modules/fs.realpath
- growl@1.10.5 node_modules/truffle/node_modules/growl
- has-flag@3.0.0 node_modules/truffle/node_modules/has-flag
- he@1.1.1 node_modules/truffle/node_modules/he
- inherits@2.0.4 node_modules/truffle/node_modules/inherits
- minimatch@3.0.4 node_modules/truffle/node_modules/minimatch
- minimist@0.0.8 node_modules/truffle/node_modules/minimist
- mkdirp@0.5.1 node_modules/truffle/node_modules/mkdirp
- ms@2.0.0 node_modules/truffle/node_modules/ms
- debug@3.1.0 node_modules/truffle/node_modules/debug
- original-require@1.0.1 node_modules/truffle/node_modules/original-require
- path-is-absolute@1.0.1 node_modules/truffle/node_modules/path-is-absolute
- supports-color@5.4.0 node_modules/truffle/node_modules/supports-color
- wrappy@1.0.2 node_modules/truffle/node_modules/wrappy
- once@1.4.0 node_modules/truffle/node_modules/once
- inflight@1.0.6 node_modules/truffle/node_modules/inflight
- glob@7.1.2 node_modules/truffle/node_modules/glob
- mocha@5.2.0 node_modules/truffle/node_modules/mocha
- truffle@5.1.33 node_modules/truffle
npm ERR! Linux 4.15.0-115-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "uninstall" "-g" "truffle"
npm ERR! node v8.10.0
npm ERR! npm  v3.5.2
npm ERR! path /usr/local/lib/node_modules/truffle/node_modules/app-module-path
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access

npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/truffle/node_modules/app-module-path'
npm ERR!  { Error: EACCES: permission denied, access '/usr/local/lib/node_modules/truffle/node_modules/app-module-path'
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules/truffle/node_modules/app-module-path' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/zulfi/npm-debug.log

松露不是未安裝的

@lc2530hz:~$ truffle version
You can improve web3's peformance when running Node.js versions older than 10.5.0 by installing the (deprecated) scrypt package in your project
Truffle v5.1.33 (core: 5.1.33)
Solidity v0.5.16 (solc-js)
Node v8.10.0
Web3.js v1.2.1
@lc2530hz:~$ 

解除安裝有效,但安裝無效

$ sudo npm install -g truffle
loadDep:original-require  ▄ ╢██████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine mocha@8.1.2: wanted: {"node":">= 10.12.0"} (current: {"node":"8.10.0loadDep:yargs-unparser →  ▌ ╢█████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine escape-string-regexp@4.0.0: wanted: {"node":">=10"} (current: {"nodeloadDep:yargs-unparser →  ▀ ╢█████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine log-symbols@4.0.0: wanted: {"node":">=10"} (current: {"node":"8.10.0loadDep:yargs-unparser →  ▀ ╢█████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine find-up@5.0.0: wanted: {"node":">=10"} (current: {"node":"8.10.0","nloadDep:fsevents → reques ▀ ╢█████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine fsevents@2.1.3: wanted: {"node":"^8.16.0 || ^10.6.0 || >=11.0.0"} (cloadDep:path-exists → req ▌ ╢██████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine locate-path@6.0.0: wanted: {"node":">=10"} (current: {"node":"8.10.0loadDep:p-locate → reques ▀ ╢██████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine p-locate@5.0.0: wanted: {"node":">=10"} (current: {"node":"8.10.0","loadDep:p-limit → request ▀ ╢██████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine p-limit@3.0.2: wanted: {"node":">=10"} (current: {"node":"8.10.0","nloadDep:chalk → request   ▌ ╢██████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine chalk@4.1.0: wanted: {"node":">=10"} (current: {"node":"8.10.0","npmnpm ERR! Linux 4.15.0-115-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "truffle"
npm ERR! node v8.10.0
npm ERR! npm  v3.5.2
npm ERR! code EMISSINGARG

npm ERR! typeerror Error: Missing required argument #1
npm ERR! typeerror     at andLogAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:31:3)
npm ERR! typeerror     at fetchPackageMetadata (/usr/share/npm/lib/fetch-package-metadata.js:51:22)
npm ERR! typeerror     at resolveWithNewModule (/usr/share/npm/lib/install/deps.js:456:12)
npm ERR! typeerror     at /usr/share/npm/lib/install/deps.js:457:7
npm ERR! typeerror     at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror     at /usr/share/npm/lib/fetch-package-metadata.js:37:12
npm ERR! typeerror     at addRequestedAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:82:5)
npm ERR! typeerror     at returnAndAddMetadata (/usr/share/npm/lib/fetch-package-metadata.js:117:7)
npm ERR! typeerror     at pickVersionFromRegistryDocument (/usr/share/npm/lib/fetch-package-metadata.js:134:20)
npm ERR! typeerror     at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror This is an error with npm itself. Please report this error at:
npm ERR! typeerror     <http://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /home/zulfi/npm-debug.log
@lc2530hz:~$ 

松露版本說沒有找到松露:

~$ truffle version
truffle: command not found
@lc2530hz:~$ 

實際上我無法升級松露,因為我的 node.js 版本是 8.10。我得到了 Spectrum 的幫助:[在1時,他們告訴我將 nod.js 升級到版本 10,我發現以下網站非常有用: 使用 nvm 升級 node.js 一旦我將 node.js 升級到 10,然後我使用命令告訴肖恩方丹:

npm install -g truffle

$ truffle version

Truffle v5.1.43 (core: 5.1.43) 
Solidity v0.5.16 (solc-js) 
Node v10.22.0 
Web3.js v1.2.1

祖爾菲。

您需要解除安裝並重新安裝 Truffle。從發布頁面

我們建議通過執行以下命令升級到最新版本的 Truffle:

npm uninstall -g truffle
npm install -g truffle

引用自:https://ethereum.stackexchange.com/questions/87210