Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[npm ERR! code EISGIT]: web3-providers-ws depends on websocket with ".git" folder. #2863

Closed
bergkvist opened this issue Jun 2, 2019 · 16 comments

Comments

@bergkvist
Copy link

Description

Expected behavior

After installing web3-providers-ws with npm, it should be possible to install other packages with npm.

Actual behavior

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

Steps to reproduce the behavior

$ mkdir new-project && cd new-project
$ npm init
$ npm install web3-providers-ws@1.0.0-beta.37 --save
$ npm install <anything> --save

Error Logs

$ 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

Versions

  • Node: v10.15.3
  • NPM: 6.9.0
  • OS: Manjaro Linux
@nivida
Copy link
Contributor

nivida commented Jun 2, 2019

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.

@0x-r4bbit
Copy link

@nivida can you please link the commit that fixes this?

@michaelsbradleyjr
Copy link
Contributor

michaelsbradleyjr commented Jun 19, 2019

@PascalPrecht I think it was this one: b27eff4.

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?

@itinance
Copy link

itinance commented Jul 2, 2019

Hey, glad you solved it! When can we expect a release with the mentioned fix?

@chrisfosterelli
Copy link

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.

@joshstevens19
Copy link
Contributor

joshstevens19 commented Jul 5, 2019

@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.

@chrisfosterelli
Copy link

@joshstevens19 Thanks. The module isn't quite at the root level, tree is closer to this:

└─┬ @0x/subproviders@4.1.0
  └─┬ ganache-core@2.5.6
    ├─┬ web3@1.0.0-beta.35
    │ └─┬ web3-core@1.0.0-beta.35
    │   └─┬ web3-core-requestmanager@1.0.0-beta.35
    │     └─┬ web3-providers-ws@1.0.0-beta.35
    │       └── websocket@1.0.26  (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.

@JirkaChadima
Copy link

@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

@michaelsbradleyjr
Copy link
Contributor

michaelsbradleyjr commented Jul 23, 2019

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 .

@JirkaChadima
Copy link

@michaelsbradleyjr Ha, awesome, the newer version of npm did the trick. Thank you!

@fulldecent
Copy link

fulldecent commented Jul 29, 2019

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 web3@1.2.0

@MarcelDanz
Copy link

MarcelDanz commented Aug 10, 2019

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

@perich
Copy link

perich commented Aug 15, 2019

This issue broke our CI pipeline. Resolved by upgrading to "web3": "1.0.0-beta.52"

@fulldecent
Copy link

Confirmed fully fixed in 1.2.1, released 2019-08-06

jefflau added a commit to ensdomains/ui that referenced this issue Sep 4, 2019
* detect when instantiated ethers provider is passed as customProvider

* handle raw RPC endpoint URL as customProvider

* remove .vscode file

* upgrade web3 to fix downstream issue with CI caused by this bug web3/web3.js#2863

* use web3 version 1.0.0-beta.55
@partyka1
Copy link

partyka1 commented Sep 17, 2019

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

boolafish added a commit to omgnetwork/plasma-contracts that referenced this issue Sep 26, 2019
This is a workaround for the following error: "/home/circleci/repo/plasma_framework/node_modules/ganache-core-sc/node_modules/web3-providers-ws/node_modules/websocket: Appears to be a git repo or submodule."
Previously the work around deletes "node_modules/**/.git", now it goes further to delete all ".git" file under node_modules.

ref: web3/web3.js#2863 (comment)
boolafish added a commit to omgnetwork/plasma-contracts that referenced this issue Sep 26, 2019
This is a workaround for the following error: "/home/circleci/repo/plasma_framework/node_modules/ganache-core-sc/node_modules/web3-providers-ws/node_modules/websocket: Appears to be a git repo or submodule."
Previously the work around deletes "node_modules/**/.git", now it goes further to delete all ".git" file under node_modules.

ref: web3/web3.js#2863 (comment)
boolafish added a commit to omgnetwork/plasma-contracts that referenced this issue Sep 26, 2019
This is a workaround for the following error: "/home/circleci/repo/plasma_framework/node_modules/ganache-core-sc/node_modules/web3-providers-ws/node_modules/websocket: Appears to be a git repo or submodule."
Previously the work around deletes "node_modules/**/.git", now it goes further to delete all ".git" file under node_modules.

ref: web3/web3.js#2863 (comment)
boolafish added a commit to omgnetwork/plasma-contracts that referenced this issue Sep 26, 2019
This is a workaround for the following error: "/home/circleci/repo/plasma_framework/node_modules/ganache-core-sc/node_modules/web3-providers-ws/node_modules/websocket: Appears to be a git repo or submodule."
Previously the work around deletes "node_modules/**/.git", now it goes further to delete all ".git" file under node_modules.

ref: web3/web3.js#2863 (comment)
boolafish added a commit to omgnetwork/plasma-contracts that referenced this issue Sep 26, 2019
This is a workaround for the following error: "/home/circleci/repo/plasma_framework/node_modules/ganache-core-sc/node_modules/web3-providers-ws/node_modules/websocket: Appears to be a git repo or submodule."
Previously the work around deletes "node_modules/**/.git", now it goes further to delete all ".git" file under node_modules.

ref: web3/web3.js#2863 (comment)
boolafish added a commit to omgnetwork/plasma-contracts that referenced this issue Sep 26, 2019
This is a workaround for the following error: "/home/circleci/repo/plasma_framework/node_modules/ganache-core-sc/node_modules/web3-providers-ws/node_modules/websocket: Appears to be a git repo or submodule."
Previously the work around deletes "node_modules/**/.git", now it goes further to delete all ".git" file under node_modules.

ref: web3/web3.js#2863 (comment)
@piijt
Copy link

piijt commented Dec 17, 2019

I initially had this error, now I get this error --> npm ERR! 404 Not Found - GET https://registry.npmjs.org/TRUE - Not found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests