无法通过尝试安装Truffle来解决EACCESS问题。
是的,我最初通过sudo而不是nvm安装了npm,但根据网页上的说明已经更正了——除非谁知道。
这个路径实际上并不存在,所以我按照一个git问题创建了它:
我尝试了这个链接中的建议:在安装npm模块时出现权限被拒绝的错误。
在Ethereum SE,使用Ubuntu的用户遇到了此问题。
查看以下链接并针对package-lock文件赋予完整权限以解决可能存在的问题:npm notice created a lockfile as package-lock.json. You should commit this file。
尝试清除npm缓存。
这位Github用户似乎通过使用
也尝试以root身份安装。
是的,我最初通过sudo而不是nvm安装了npm,但根据网页上的说明已经更正了——除非谁知道。
这个路径实际上并不存在,所以我按照一个git问题创建了它:
/root/.config/truffle/
[root@home config]# ls -la |grep truffle
drwxrwxr-x. 2 root root 6 Jul 14 17:08 truffle
[user@home ~]$ nvm --version
0.34.0
$ npm -v
6.9.0
已分配完整权限给node_modules
:
ll|grep node
drwxrwxrwx. 31 user user 4096 Jul 14 16:58 node_modules
我尝试了这个链接中的建议:在安装npm模块时出现权限被拒绝的错误。
在Ethereum SE,使用Ubuntu的用户遇到了此问题。
查看以下链接并针对package-lock文件赋予完整权限以解决可能存在的问题:npm notice created a lockfile as package-lock.json. You should commit this file。
尝试清除npm缓存。
这位Github用户似乎通过使用
sudo
解决了问题:truffle compile error (EACCES: permission denied) on V5 w/ Linux #1212。也尝试以root身份安装。
$ sudo npm install -g truffle
/usr/local/lib/nodejs/node-v10.16.0-linux-x64/bin/truffle ->/usr/local/lib/nodejs/node-v10.16.0-linux-x64/lib/node_modules/truffle/build/cli.bundled.js
> truffle@5.0.27 postinstall /usr/local/lib/nodejs/node-v10.16.0-linux-x64/lib/node_modules/truffle
> node ./scripts/postinstall.js
Error: EACCES: permission denied, open '/root/.config/truffle/config.json'
You don't have access to this file.
at Object.openSync (fs.js:443:3)
at Object.readFileSync (fs.js:343:35)
at Configstore.get all [as all] (/usr/local/lib/nodejs/node-v10.16.0-linux-x64/lib/node_modules/truffle/build/webpack:/~/configstore/index.js:31:1)
at new Configstore (/usr/local/lib/nodejs/node-v10.16.0-linux-x64/lib/node_modules/truffle/build/webpack:/~/configstore/index.js:25:31)
at Function.Config.getUserConfig (/usr/local/lib/nodejs/node-v10.16.0-linux-x64/lib/node_modules/truffle/build/webpack:/packages/truffle-config/index.js:395:1)
at Object.<anonymous> (/usr/local/lib/nodejs/node-v10.16.0-linux-x64/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/mnemonics/mnemonic.js:11:1)
at __webpack_require__ (/usr/local/lib/nodejs/node-v10.16.0-linux-x64/lib/node_modules/truffle/build/webpack:/webpack/bootstrap fa1fcd3fc6c4fef3eaf9:19:1)
at Object.command.command (/usr/local/lib/nodejs/node-v10.16.0-linux-x64/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/commands/develop.js:2:22)
at __webpack_require__ (/usr/local/lib/nodejs/node-v10.16.0-linux-x64/lib/node_modules/truffle/build/webpack:/webpack/bootstrap fa1fcd3fc6c4fef3eaf9:19:1)
at Object.module.exports.$schema (/usr/local/lib/nodejs/node-v10.16.0-linux-x64/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/commands/index.js:9:12)
at __webpack_require__ (/usr/local/lib/nodejs/node-v10.16.0-linux-x64/lib/node_modules/truffle/build/webpack:/webpack/bootstrap fa1fcd3fc6c4fef3eaf9:19:1)
at Object.<anonymous> (/usr/local/lib/nodejs/node-v10.16.0-linux-x64/lib/node_modules/truffle/build/webpack:/packages/truffle-core/cli.js:33:29)
at __webpack_require__ (/usr/local/lib/nodejs/node-v10.16.0-linux-x64/lib/node_modules/truffle/build/webpack:/webpack/bootstrap fa1fcd3fc6c4fef3eaf9:19:1)
at /usr/local/lib/nodejs/node-v10.16.0-linux-x64/lib/node_modules/truffle/build/webpack:/webpack/bootstrap fa1fcd3fc6c4fef3eaf9:65:1
at Object.<anonymous> (/usr/local/lib/nodejs/node-v10.16.0-linux-x64/lib/node_modules/truffle/build/cli.bundled.js:71:10)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
at startup (internal/bootstrap/node.js:283:19)
Error: Error while attempting to download and cache solc 0.5.8: Command failed: node ./build/cli.bundled.js obtain --solc=0.5.8
Error: EACCES: permission denied, open '/root/.config/truffle/config.json'
You don't have access to this file.
at Object.openSync (fs.js:443:3)
at Object.readFileSync (fs.js:343:35)
at Configstore.get all [as all] (/usr/local/lib/nodejs/node-v10.16.0-linux-x64/lib/node_modules/truffle/build/webpack:/~/configstore/index.js:31:1)
at new Configstore (/usr/local/lib/nodejs/node-v10.16.0-linux-x64/lib/node_modules/truffle/build/webpack:/~/configstore/index.js:25:31)
at Function.Config.getUserConfig (/usr/local/lib/nodejs/node-v10.16.0-linux-x64/lib/node_modules/truffle/build/webpack:/packages/truffle-config/index.js:395:1)
at Object.<anonymous> (/usr/local/lib/nodejs/node-v10.16.0-linux-x64/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/mnemonics/mnemonic.js:11:1)
at __webpack_require__ (/usr/local/lib/nodejs/node-v10.16.0-linux-x64/lib/node_modules/truffle/build/webpack:/webpack/bootstrap fa1fcd3fc6c4fef3eaf9:19:1)
at Object.command.command (/usr/local/lib/nodejs/node-v10.16.0-linux-x64/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/commands/develop.js:2:22)
at __webpack_require__ (/usr/local/lib/nodejs/node-v10.16.0-linux-x64/lib/node_modules/truffle/build/webpack:/webpack/bootstrap fa1fcd3fc6c4fef3eaf9:19:1)
at Object.module.exports.$schema (/usr/local/lib/nodejs/node-v10.16.0-linux-x64/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/commands/index.js:9:12)
at __webpack_require__ (/usr/local/lib/nodejs/node-v10.16.0-linux-x64/lib/node_modules/truffle/build/webpack:/webpack/bootstrap fa1fcd3fc6c4fef3eaf9:19:1)
at Object.<anonymous> (/usr/local/lib/nodejs/node-v10.16.0-linux-x64/lib/node_modules/truffle/build/webpack:/packages/truffle-core/cli.js:33:29)
at __webpack_require__ (/usr/local/lib/nodejs/node-v10.16.0-linux-x64/lib/node_modules/truffle/build/webpack:/webpack/bootstrap fa1fcd3fc6c4fef3eaf9:19:1)
at /usr/local/lib/nodejs/node-v10.16.0-linux-x64/lib/node_modules/truffle/build/webpack:/webpack/bootstrap fa1fcd3fc6c4fef3eaf9:65:1
at Object.<anonymous> (/usr/local/lib/nodejs/node-v10.16.0-linux-x64/lib/node_modules/truffle/build/cli.bundled.js:71:10)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
at startup (internal/bootstrap/node.js:283:19)
at postinstallObtain (/usr/local/lib/nodejs/node-v10.16.0-linux-x64/lib/node_modules/truffle/scripts/postinstall.js:13:11)
at Object.<anonymous> (/usr/local/lib/nodejs/node-v10.16.0-linux-x64/lib/node_modules/truffle/scripts/postinstall.js:20:3)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
+ truffle@5.0.27
updated 1 package in 5.873s
基于Cypress问题的不同尝试。
$ sudo npm install --unsafe-perm=true --allow-root truffle
path.js:1077
path = process.cwd();
^
Error: ENOENT: no such file or directory, uv_cwd
at Object.resolve (path.js:1077:24)
at Function.Module._resolveLookupPaths (internal/modules/cjs/loader.js:534:17)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:629:20)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at /usr/local/lib/nodejs/node-v10.16.0-linux-x64/lib/node_modules/npm/bin/npm-cli.js:19:21
at Object.<anonymous> (/usr/local/lib/nodejs/node-v10.16.0-linux-x64/lib/node_modules/npm/bin/npm-cli.js:152:3)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)