After installing web3-providers-ws with npm, it should be possible to install other packages with npm.
npm fails upon trying to install a second package, becuase node_modules/web3-providers-ws/node_modules/websocket/.git exists.
A temporary workaround is to manually delete the .git-folder
$Â mkdir new-project && cd new-project
$ npm init
$ npm install [email protected] --save
$ npm install <anything> --save
$ npm install --save ramda
npm ERR! path /home/user/new-project/node_modules/web3-providers-ws/node_modules/websocket
npm ERR! code EISGIT
npm ERR! git /home/user/new-project/node_modules/web3-providers-ws/node_modules/websocket: Appears to be a git repo or submodule.
npm ERR! git /home/user/new-project/node_modules/web3-providers-ws/node_modules/websocket
npm ERR! git Refusing to remove it. Update manually,
npm ERR! git or move it out of the way first.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/user/.npm/_logs/2019-06-02T08_10_24_020Z-debug.log
This got fixed with the latest version of Web3.
Because of the internal architectural changes does Truffle/Drizzle currently not support the latest version of Web3. I'm in contact with Truffle, Embark, OpenZeppeling, and Nomiclabs to solve this issue with defining beta.37 as 1.0 release and to use the new architecture for the 2.0 version of Web3. I apologize for the confusion and the situation you are in.
@nivida can you please link the commit that fixes this?
@PascalPrecht I think it was this one: https://github.com/ethereum/web3.js/commit/b27eff44920d4776b07c19db7f42ec518796ee46.
I tried:
npm pack git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible && tar xvzf websocket-1.0.26.tgz && cd package && ls -ladh .*
And I see the .git directory in the output. That directory is not seen with the following:
npm pack websocket@^1.0.28 && tar xvzf websocket-1.0.28.tgz && cd package && ls -ladh .*
web3's 1.x branch still has the old websocket:
https://github.com/ethereum/web3.js/blob/1.x/packages/web3-providers-ws/package.json#L12
@nivida could the commit that bumped the websocket dep be cherry-picked to the 1.x branch?
Hey, glad you solved it! When can we expect a release with the mentioned fix?
Is there a workaround for this? This is _somewhere_ in my module tree as a dependency of a dependency and it completely breaks npm functionality.
@chrisfosterelli I think if you add this preinstall script in your package.json > scripts object it should be a temp workaround, .git folders should never really be pushed to npm so removing all is probably the best bet here.
"preinstall": "rm -rf node_modules/*/.git/"
can you give it ago, do npm install again and see if the error goes.
@joshstevens19 Thanks. The module isn't quite at the root level, tree is closer to this:
└─┬ @0x/[email protected]
└─┬ [email protected]
├─┬ [email protected]
│ └─┬ [email protected]
│ └─┬ [email protected]
│ └─┬ [email protected]
│ └── [email protected] (git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2)
Looks like an existing websockets dependency already exists at node_modules/websockets for another dependency, so npm changed the install path to node_modules/ganache-core/node_modules/web3-providers-ws/node_modules/websocket/.git. It worked singling out that directory.
Installation paths are not deterministic so this might break for others who install our project but that gets npm working at least for now without deleting the entire modules tree before each install.
@nivida Any chance that this will get backported soon-ish after the release of 1.2.0? I'd be happy to submit a PR, but I'm having trouble building and testing everything locally...
The build-all script fails with Cannot find module web3-core when run on the 1.x branch
So, it turns out the fix for the .git/ directory was switching from a git:// URL to a github: specifier; the preinstall script in packages/web3-providers-ws/package.json has no effect and can be removed. You can test it by switching "websocket": "github:frozeman/WebSocket-Node#browserifyCompatible" back to git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible. After switching it and installing the dependencies, node_modules/websocket/.git will exist despite the preinstall script.
The problem with the git:// URL is an npm bug. See: https://npm.community/t/installing-with-git-url-results-in-spurious-git-directory-within-node-modules/8815. It's been fixed in npm 6.10.1 but you may need to clear your npm cache with npm cache clear --force.
@michaelsbradleyjr Ha, awesome, the newer version of npm did the trick. Thank you!
Confirming fix:
Environment
node --version # v12.6.0
npm update -g npm
npm --version # should be 6.10.2
npm install # now the build works on [email protected]
Can't confirm the fix in Bitbucket build pipeline. Anyone else experiencing this too?
image: node:12
npm --version #is 6.10.2
npm install #fails on webpack with web3 version ^1.2.0
This issue broke our CI pipeline. Resolved by upgrading to "web3": "1.0.0-beta.52"
Confirmed fully fixed in 1.2.1, released 2019-08-06
After running bitcore build hundreds times, past few months I suddenly got this error.... I still don't know what happened, but @fulldecent fix helped
I initially had this error, now I get this error --> npm ERR! 404 Not Found - GET https://registry.npmjs.org/TRUE - Not found
Most helpful comment
Confirming fix:
Environment