【发布时间】:2019-02-25 21:41:20
【问题描述】:
所以我一直在处理一个非常奇怪的问题,它似乎是突然发生的。我的 truffle 编译、测试和迁移命令实际上什么也没做。但是,我的其他命令(例如开发、网络、控制台等)可以正常工作。当我在控制台中输入 truffle migrate 时,会发生这种情况: Nothing happens and the the terminal line just goes to a new line
这就是我运行 truffle develop 时发生的情况: Works as expected
我用一个开箱即用的毛毛雨应用程序做了同样的事情。它的配置文件如下所示:
const path = require("path");
module.exports = {
// See <http://truffleframework.com/docs/advanced/configuration>
// to customize your Truffle configuration!
contracts_build_directory: path.join(__dirname, "app/src/contracts"),
solc: {
optimizer: {
enabled: true,
runs: 200
}
},
networks: {
development: {
host: "LOCALHOST",
port: 8545,
network_id: "5777", // Match any network id
}
}};
迁移文件如下所示:
const SimpleStorage = artifacts.require("SimpleStorage");
const TutorialToken = artifacts.require("TutorialToken");
const ComplexStorage = artifacts.require("ComplexStorage");
module.exports = function(deployer) {
deployer.deploy(SimpleStorage);
deployer.deploy(TutorialToken);
deployer.deploy(ComplexStorage);
};
一切看起来都很正常,我似乎无法弄清楚问题所在。以前可以运行的应用程序现在似乎无法运行 truffle 编译、迁移或测试命令。
所以我最初认为这可能是我的 npm 数据包有问题,或者可能需要新的更新。所以我卸载并重新安装了 truffle@latest。当我下载某些软件包时,我开始注意到有时会出现特定错误:
/Users/aditya/.nvm/versions/node/v11.10.0/bin/truffle ->
/Users/aditya/.nvm/versions/node/v11.10.0/lib/node_modules/truffle/build/cli.bundled.js
> keccak@1.4.0 install /Users/aditya/.nvm/versions/node/v11.10.0/lib/node_modules/truffle/node_modules/keccak
> npm run rebuild || echo "Keccak bindings compilation fail. Pure JS implementation will be used."
> keccak@1.4.0 rebuild /Users/aditya/.nvm/versions/node/v11.10.0/lib/node_modules/truffle/node_modules/keccak
> node-gyp rebuild
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/Users/aditya/.nvm/versions/node/v11.10.0/lib/node_modules/truffle/node_modules/keccak/build'
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/Users/aditya/.nvm/versions/node/v11.10.0/bin/node" "/Users/aditya/.nvm/versions/node/v11.10.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/aditya/.nvm/versions/node/v11.10.0/lib/node_modules/truffle/node_modules/keccak
gyp ERR! node -v v11.10.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! keccak@1.4.0 rebuild: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the keccak@1.4.0 rebuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Keccak bindings compilation fail. Pure JS implementation will be used.
+ truffle@5.0.5
added 91 packages from 305 contributors in 7.797s
在安装特定软件包时,这个 node-gyp 错误不断出现。所以我通过卸载并重新安装 npm 对我的 npm 进行了彻底的检查。这没有任何改变,而且这个错误仍然不断出现。我不确定这个错误是否与 Truffle 命令问题有关。
【问题讨论】:
-
Truffle v4 怎么样?可能 v5/latest 不适用于您的环境。
-
使用 sudo gyp ERR!堆栈错误:EACCES:权限被拒绝,
标签: npm solidity node-gyp smartcontracts truffle