I'm trying to create a local repository to test a composer project but
composer create-project --repository-url=/path/to/packages.json vendor/project-name
fails with
[UnexpectedValueException]
Unknown package has no name defined [...]
My packages.json
is:
{
"packages": {
"vendor/project-name": {
"dev-master": {
"name": "vendor/project-name",
"type": "project",
"version": "dev-master",
"source": {
"url": "/path/to/project/.git",
"type": "git"
}
}
}
}
}
As for composer's guide, this should be enough.
Any clue?
Try clearing Composer's cache by running composer clear-cache . Ensure you're installing vendors straight from your composer. json via rm -rf vendor && composer update -v when troubleshooting, excluding any possible interferences with existing vendor installations or composer. lock entries.
Execute this and tell me if it works for you too:
mkdir /tmp/project-name
cd /tmp/project-name
git init
vim (or whatever you like) packages.json
Paste and save:
{
"package": {
"name": "vendor/project-name",
"version": "1.0.0",
"source": {
"url": "/tmp/project-name/.git",
"type": "git",
"reference": "master"
}
}
}
Execute:
echo '{ "name": "test/test", "version": "1.0.0", "dist": { "url": "http://dummy.com/dummy.zip", "type": "zip" } }' > composer.json
git add packages.json composer.json
git commit -a -m "first commit"
And then create your package:
composer create-project --repository-url=/tmp/project-name/packages.json vendor/project-name
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With