[Ethereum] Error in unboxing truffle-react on Windows

nodejsreacttruffletruffle-box

I am trying to unbox truffle-react but I am stuck with this error:

$ truffle unbox react
Downloading...
Unpacking...
Setting up...
Error: Command failed: npm install
npm WARN deprecated ethereumjs-testrpc@2.2.7: ethereumjs-testrpc has been renamed to ganache-cli, please use this package from now on.
npm WARN deprecated babel-preset-es2015@6.24.1: 🙌  Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!
npm WARN deprecated jade@0.26.3: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated to-iso-string@0.0.2: to-iso-string has been deprecated, use @segment/to-iso-string instead.
npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
gyp ERR! build error
gyp ERR! stack Error:`C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (E:\Important documents\New folder\node_modules\npm\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "E:\\Important documents\\New folder\\node.exe" "E:\\Important documents\\New folder\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd E:\Important documents\Blockchain\node_modules\keccak
gyp ERR! node -v v8.9.4
gyp ERR! node-gyp -v v3.6.2
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.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\DELL\AppData\Roaming\npm-cache\_logs\2018-05-08T16_19_12_076Z-debug.log
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (E:\Important documents\New folder\node_modules\npm\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "E:\\Important documents\\New folder\\node.exe" "E:\\Important documents\\New folder\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd E:\Important documents\Blockchain\node_modules\scrypt
gyp ERR! node -v v8.9.4
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN The package dotenv is included as both a dev and production dependency.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! scrypt@6.0.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the scrypt@6.0.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\DELL\AppData\Roaming\npm-cache\_logs\2018-05-08T16_19_24_891Z-debug.log

at ChildProcess.exithandler (child_process.js:275:12)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)

I tried solutions like switching back to python 2.7 as given here and some other methods like installing node gyp given here and here.
Nothing is working, please help.

However, truffle unbox webpack is working neatly! Node version is 8.9.4 and OS: Windows

Best Answer

I fixed it with these steps (note step 1 takes some time):

  1. Run command prompt as administrator
  2. npm install --global--production windows-build-tools
  3. npm install --global node-gyp
  4. in package.json file put this in devdependecies section:

    "deepmerge": "^2.1.0", "is-plain-object": "^2.0.4"

  5. navigate to directory of drizzle unboxes app and run npm install or npm update if you already built it

  6. npm list drizzle and if it says drizzle@1.2.1 then run npm i drizzle@1.1.5

  7. npm i web3@1.0.0-beta.34

  8. ganache-cli -b 3

  9. Get the seed phrase that it gives you and goto MetaMask log out if your logged in then log in with seed phrase and change networks to localhost 8545. Once your in you should have 100eth

  10. then go back to terminal and do

     truffle compile
     truffle migrate
    

You should now check MetaMask your total ETH should be 99.76~ or similar.

  1. npm run start
Related Topic