Truffle

在 Windows 10 上的 Ubuntu 子系統上安裝 testrpc / truffle 時出錯

  • June 10, 2017

節點版本 7.10.0

已安裝 npm

Windows 10 上的 Ubuntu 子系統

我嘗試安裝 testrpc 和松露。當我通過安裝松露

sudo npm install -g truffle

我總是收到以下錯誤:

npm ERR! code 1
npm ERR! Command failed: /usr/bin/git clone --depth=1 -q -b master https://github.com/debris/bignumber.js.git /home/xxx/.npm/_cacache/tmp/git-clone-f9c59612
npm ERR! /home/xxx/.npm/_cacache/tmp/git-clone-f9c59612/.git: Permission denied
npm ERR!

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/xxx/.npm/_logs/2017-06-10T08_24_33_791Z-debug.log

添加 –unsafe-perm 也無濟於事。

通過安裝 testrpc 時

sudo npm install -g ethereumjs-testrpc

安裝似乎有效,但是當我執行 testrpc 時,我得到了

/usr/lib/node_modules/ethereumjs-testrpc/node_modules/solc/soljson.js:1
(function (exports, require, module, __filename, __dirname) { var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=typeof window==="object";var ENVIRONMENT_IS_WORKER=typeof importScripts==="function";var ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){if(!Module["print"])Module["print"]=function print(x){process["stdout"].write(x+"\n")};if(!Module["printErr"])Module["printErr"]=function printErr(x){process["stderr"].write(x+"\n")};var nodeFS=require("fs");var nodePath=require("path");Module["read"]=function read(filename,binary){filename=nodePath["normalize"](filename);var ret=nodeFS["readFileSync"](

Error: Cannot find module './build/Release/scrypt'
   at Function.Module._resolveFilename (module.js:470:15)
   at Function.Module._load (module.js:418:25)
   at Module.require (module.js:498:17)
   at require (internal/module.js:20:19)
   at Object.<anonymous> (/usr/lib/node_modules/ethereumjs-testrpc/node_modules/scrypt/index.js:3:20)
   at Module._compile (module.js:571:32)
   at Object.Module._extensions..js (module.js:580:10)
   at Module.load (module.js:488:32)
   at tryModuleLoad (module.js:447:12)
   at Function.Module._load (module.js:439:3)

為什麼會出現這些錯誤,我該怎麼辦?

謝謝!

編輯:

TestRPC 問題可以通過

chmod -R 777

/usr/lib/node_modules

你可以試試: sudo npm install -g truffle@beta

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