Truffle: Error installing [email protected]

Created on 9 Aug 2019  路  10Comments  路  Source: trufflesuite/truffle

Issue

npm install truffle-contract --save-dev fails with the following error:

> [email protected] install E:\project-folder\node_modules\sha3
> node-gyp rebuild


E:\project-folder\node_modules\sha3>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\user\Anaconda3\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:294:12)
gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:970:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd E:\project-folder\node_modules\sha3
gyp ERR! node -v v10.15.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN [email protected] No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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\user\AppData\Roaming\npm-cache\_logs\2019-08-09T09_46_09_741Z-debug.log

But the following steps work:

  1. npm install [email protected] --save-dev

    • this would produce the same error as above

  2. After 1, npm install truffle-contract --save-dev works fine.

Steps to Reproduce

  1. npm install truffle-contract --save-dev => error
  2. npm install [email protected] --save-dev => error
  3. npm install truffle-contract --save-dev => success

Expected Behavior

Step 1 should work fine

Environment

  • Operating System: Windows 10
  • Truffle version (v5.0.29):
  • node version (v10.15.3):
  • npm version (6.4.1):
bug help wanted needs reproduced

Most helpful comment

Will have to look into this. Thanks for raising the issue!

All 10 comments

Will have to look into this. Thanks for raising the issue!

Hi, is this still a problem on the most recent version of Truffle Contract? Thank you!

I'm not sure. I haven't been using truffle for some time now.

Closing for issue maintenance. If you want us to pursue this further then please do get back to us and we'll try to help you out! Thanks!

Yes it's still an issue. I have yet to find a work around.

Ah, yeah this still would be an issue when installing @truffle/contract as a devDep. https://github.com/trufflesuite/truffle/blob/develop/packages/contract/package.json#L44

See the PlantUML diagram in https://github.com/trufflesuite/truffle/issues/3175.

Hi @PatrickAlphaC thanks for getting back to us! Can you try this again with the latest version of @truffle/contract? If that doesn't work, can you provide reproduction steps (if they are different in any way from those in the original issue)? Thanks!

Scratch what I said earlier. @truffle/contract isn't pulling down ganache-core when installed as a devDep.

Looks like this was an old issue with web3 having node-gyp as a deeply nested dependency in beta.37.
This issue should be resolved on latest truffle-contract and @truffle/contract.

Works for me now :)

Very cool, closing this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maximilianh picture maximilianh  路  3Comments

rstormsf picture rstormsf  路  3Comments

timothywangdev picture timothywangdev  路  3Comments

hefgi picture hefgi  路  3Comments

rjl493456442 picture rjl493456442  路  4Comments