Do you want to request a feature or report a bug?
Bug
What is the current behavior?
Running yarn on a new system gives me this error:
Error: Invalid protocol: git+https:
at Request.init (/usr/local/lib/node_modules/yarn/node_modules/request/request.js:459:31)
at new Request (/usr/local/lib/node_modules/yarn/node_modules/request/request.js:128:8)
at request (/usr/local/lib/node_modules/yarn/node_modules/request/index.js:54:10)
at RequestManager.execute (/usr/local/lib/node_modules/yarn/lib/util/request-manager.js:327:17)
at RequestManager.shiftQueue (/usr/local/lib/node_modules/yarn/lib/util/request-manager.js:353:10)
at Promise (/usr/local/lib/node_modules/yarn/lib/util/request-manager.js:150:12)
at RequestManager.request (/usr/local/lib/node_modules/yarn/lib/util/request-manager.js:148:21)
at NpmRegistry.request (/usr/local/lib/node_modules/yarn/lib/registries/npm-registry.js:97:32)
at TarballFetcher.fetchFromExternal (/usr/local/lib/node_modules/yarn/lib/fetchers/tarball-fetcher.js:176:21)
at TarballFetcher._fetch (/usr/local/lib/node_modules/yarn/lib/fetchers/tarball-fetcher.js:218:19)
If the current behavior is a bug, please provide the steps to reproduce.
Running yarn on a new system
What is the expected behavior?
Install successfully
Please mention your node.js, yarn and operating system version.
Node: 6.9.1
Yarn: 0.16.0
OS: CentOS 6.8
Need more information to reproduce this like the package.json
you're using.
{
"name": "web",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node-dev app.js"
},
"repository": {
"type": "git",
"url": ""
},
"author": "",
"bugs": {
"url": ""
},
"homepage": "",
"private": true,
"dependencies": {
"co": "^4.6.0",
"cookie-parser": "^1.4.3",
"lodash": "^4.15.0",
"lokka": "^1.7.0",
"lokka-transport-http": "^1.6.1",
"moment": "^2.15.1",
"parse-cache-control": "^1.0.1",
"request": "^2.74.0",
"sand": "^1.7.2",
"sand-clients": "^1.0.0",
"sand-eventsd": "1.2.0",
"sand-grain": "^1.2.1",
"sand-graphql": "1.1.0",
"sand-http": "^2.8.4",
"sand-mysql": "^2.2.2"
}
}
What's weird is that it worked when I ran yarn in another project on the same machine, then came back and ran yarn again on this project and it worked. It's happened twice, both on fresh GCE instances.
I couldn't reproduce, works fine with [email protected]
. @lambertkuang can you try again with the latest yarn
? I appreciate you're saying it only doesn't work the first time you run it. If you can still reproduce that, I will get a CentOS VM and try as well.
It still reproduce for me.
Error: Invalid protocol: git:
at Request.init (/usr/local/lib/node_modules/yarn/node_modules/request/request.js:459:31)
at new Request (/usr/local/lib/node_modules/yarn/node_modules/request/request.js:128:8)
at request (/usr/local/lib/node_modules/yarn/node_modules/request/index.js:54:10)
at RequestManager.execute (/usr/local/lib/node_modules/yarn/lib/util/request-manager.js:348:17)
at RequestManager.shiftQueue (/usr/local/lib/node_modules/yarn/lib/util/request-manager.js:374:10)
at data (/usr/local/lib/node_modules/yarn/lib/util/request-manager.js:264:12)
at Extract.extractorStream.pipe.on.on (/usr/local/lib/node_modules/yarn/lib/fetchers/tarball-fetcher.js:128:9)
at emitNone (events.js:91:20)
at Extract.emit (events.js:185:7)
at DirWriter.<anonymous> (/usr/local/lib/node_modules/yarn/node_modules/tar/lib/extract.js:82:8)
Node: 6.9.1
Yarn: 0.17.8
linux x64
I also get this same error, on a debian jessie docker container. Doesn't happen on macOS El Capitan for some reason.
events.js:141
throw er; // Unhandled 'error' event
^
Error: Invalid protocol: git+https:
at Request.init (/root/.yarn/node_modules/request/request.js:459:31)
at new Request (/root/.yarn/node_modules/request/request.js:128:8)
at request (/root/.yarn/node_modules/request/index.js:54:10)
at RequestManager.execute (/root/.yarn/lib-legacy/util/request-manager.js:362:17)
at RequestManager.shiftQueue (/root/.yarn/lib-legacy/util/request-manager.js:389:10)
at /root/.yarn/lib-legacy/util/request-manager.js:276:12
at Extract.<anonymous> (/root/.yarn/lib-legacy/fetchers/tarball-fetcher.js:146:9)
at emitNone (events.js:72:20)
at Extract.emit (events.js:166:7)
at DirWriter.<anonymous> (/root/.yarn/node_modules/tar/lib/extract.js:82:8)
yarn 0.18.0
In case this helps anyone, I ran into this when testing a migration from npm to yarn and running CI on travis. I was able to work around the problem by changing our dependency references in package.json
from the form
"dependency-name": "Company/dependency-name",
to
"dependency-name": "git://github.com/Company/dependency-name",
node 6.3.0
yarn 0.17.10
I guess the problem is more troublesome when one does not have control over that, say, when a package has a dependency written as "dependency-name": "Company/dependency-name"
I found a temporary fix. Delete the yarn.lock file when trying to run on a new machine. Yarn will generate another one.
@shkfnly kinda defeats the purpose though. The idea of using a lock file is to make sure you always have the same dependencies 鈽癸笍
I'm noticing this as well
Same issue. Running yarn 0.19.1 and node 7.4.0 on macOS and Ubuntu Linux. Deleting yarn.lock
is not an acceptable solution. Error message:
yarn install v0.19.1
[1/5] Resolving packages...
[2/5] Fetching packages...
error An unexpected error occurred: "Invalid protocol: git:".
info If you think this is a bug, please open a bug report with the information provided in "/opt/atlassian/pipelines/agent/build/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
finally got repro steps for this:
yarn cache clean
yarn add [email protected]
yarn add [email protected]
rm -rf node_modules/
yarn cache clean
yarn
that produces a yarn.lock
entry like
[email protected], "taffydb@git+https://github.com/hegemonic/taffydb.git":
version "2.6.2"
resolved "git+https://github.com/hegemonic/taffydb.git#e41b5e179e197bb85c5fb887b707672b1e5ca079"
which for whatever reason produces the error.
adding "taffydb": "2.6.2"
to our package.json
gives the working entry of
[email protected]:
version "2.6.2"
resolved "https://registry.yarnpkg.com/taffydb/-/taffydb-2.6.2.tgz#7cbcb64b5a141b6a2efc2c5d2c67b4e150b2a268"
"taffydb@git+https://github.com/hegemonic/taffydb.git":
version "2.6.2"
resolved "git+https://github.com/hegemonic/taffydb.git#e41b5e179e197bb85c5fb887b707672b1e5ca079"
/shrug
Hi,
I got this error too on yarn v0.24.6. Any idea about this ?
Hi, got the same issue on v0.23.. I upgraded to v0.24.6 but got same issue. I'm unsure of what info I should provide, but this is the last lines of yarn-error.log
yargs@~3.10.0:
version "3.10.0"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1"
dependencies:
camelcase "^1.0.2"
cliui "^2.1.0"
decamelize "^1.0.0"
window-size "0.1.0"
yn@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/yn/-/yn-1.2.0.tgz#d237a4c533f279b2b89d3acac2db4b8c795e4a63"
Trace:
Error: Invalid protocol: git:
at Request.init (C:\Program Files (x86)\Yarn\lib\yarn-cli.js:108126:31)
at new Request (C:\Program Files (x86)\Yarn\lib\yarn-cli.js:107796:8)
at request (C:\Program Files (x86)\Yarn\lib\yarn-cli.js:106394:10)
at RequestManager.execute (C:\Program Files (x86)\Yarn\lib\yarn-cli.js:56300:17)
at RequestManager.shiftQueue (C:\Program Files (x86)\Yarn\lib\yarn-cli.js:56327:10)
at promise.default (C:\Program Files (x86)\Yarn\lib\yarn-cli.js:56104:12)
at Promise.F (C:\Program Files (x86)\Yarn\lib\yarn-cli.js:29142:28)
at RequestManager.request (C:\Program Files (x86)\Yarn\lib\yarn-cli.js:56102:21)
at NpmRegistry.request (C:\Program Files (x86)\Yarn\lib\yarn-cli.js:30492:32)
at TarballFetcher.fetchFromExternal (C:\Program Files (x86)\Yarn\lib\yarn-cli.js:54425:21)
Deleted yarn.lock and everything works fine.
Keep running into this setting up new devs. Deleting yarn.lock
is not a good solution as it defeats the purpose of having the file in the same place (eg everyone installs the same versions of dependencies). It also is only temporary - once the yarn.lock is generated it can't be used by anyone else due to this issue.
Has anyone else found a different workaround?
One thing that worked for us was to:
yarn.lock
for anything using:
resolved "git+https://github.com/foo/bar.git#1234"
yarn upgrade
the package to any new version. hopefully commenting out the block allows you to run the upgrade yarn upgrade
back to the version you were using before. The changes to the lock file should be minimal. We just inherited a project that uses Yarn so I installed it today and we are seeing this error. I agree that deleting the lock file is _not_ an acceptable solution. I see a commit was merged on July 13th. Was that supposed to fix the issue?
If it helps find this bug, I ran into this when using a git submodule and trying to run yarn install
inside of the submodule.
I was able to copy the package.json
into a clean folder and it ran just fine. However, any time, even after deleting yarn cache (manually and with yarn cache clean
), it always failed to install properly inside of the submodule.
Currently my workaround is ok for me, but ideally would be great if there's a solution to this bug. Cheers!
this worked for me:
npm uninstall yarn -g
npm install yarn -g
yarn install
upgrade yarn to latest version and everything works fine.
Tried deleting yarn.lock file, it now requires a yarn install, cannot yarn install as it hits the same error.... error An unexpected error occurred: "Invalid protocol: localhost:".
Closing this. If this is is still an issue on 1.21.1, please comment and I'll reopen.
Most helpful comment
I found a temporary fix. Delete the yarn.lock file when trying to run on a new machine. Yarn will generate another one.