The package name "apzentral/ink" is invalid - composer-php

When I go to https://packagist.org/packages/submit to submit my package.
This error is shown,
The package name apzentral/ink is invalid, it should have a vendor name, a forward slash, and a package name. The vendor and package name can be words separated by -, . or _. The complete name should match "[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9]([_.-]?[a-z0-9]+)*".
I would like to know what is wrong in my git repository setup.
Here is the link to go to my repository
Thank you.

If you look at your composer.json file, you'll see:
"name": " apzentral/ink",
Do you notice the space before the package name? That's what causing the failure (a space is not valid in a package name)
"name": "apzentral/ink"

If you're here and if you don't have any issues in the package name in composer.json, probably you may want to check your composer version. I was using Composer version 2.0.11. Once I downgraded it to 1.6.3, it worked smoothly.

Related

Requesting specific tagged version for locally developed composer package

I am developing a package for a Laravel project on my local machine. I have also spun up a Laravel app so I can manually test the package. My package is located at /home/me/packages/me/my-package and a commit (git) has been tagged with '0.1'.
I want to be able to switch between tagged versions and use specific versions in different projects but having issues.
In my main apps composer file, I am requiring the package like so:
...
"require" : {
"me/my-package" : "0.1"
}
...
"repositories" : [
{
"type": "path",
"url": "/home/me/packages/me/my-package"
}
]
This results in an error:
Problem 1
- Root composer.json requires me/my-package 0.1, found me/my-package[dev-main] but it does not match the constraint.
I have also tried:
"require" : {
"me/my-package" : "dev-main#0.1"
}
(This was an idea taken from How to use a specific tag/version with composer and a private git repository?). This goes through without any errors but:
$ composer show | grep me/my-package
me/my-package dev-main My Package
What is the correct way install a specific version of a package when developing it locally?
Probably the only thing why you hit this message is that you have "type": "path" and not "type": "vcs".
This is that Composer will only refer one version and only one version dev-main. The reason is:
If the package [path repository] is a local VCS repository, the version may be inferred by the branch or tag that is currently checked out. (ref)
You have the main branch checked out at /home/me/packages/me/my-package (/home/me/packages/me/my-package/.git/HEAD content is ref: refs/heads/main and /home/me/packages/me/my-package/.git/refs/heads/main points to the git revision) and composer will only take that one.
You should have no problem to make that change from path to vcs given:
You already have a (git) repository at /home/me/packages/me/my-package (looks so by your question)
You know the absolute path on your local system to that repository (again, looks so by your question: /home/me/packages/me/my-package).
Given these two points, Composer is able to obtain the VCS tagged versions from that path. So basically only the change of the "type":
"repositories" : [
{
"type": "vcs",
"url": "/home/me/packages/me/my-package"
}
]
Just take care that "url" contains the absolute path (and there is a git repository at that place). Likely already all set in your case, just saying.
Git is very prominent that's why I mentioned it here, for other types of VCS Composer also has options at hand. The details - also for git etc. - are available here:
VCS - Repositories (getcomposer.org)

Replacing inconvenient package name. Got error: replacement module without version must be directory path (rooted or starting with ./ or ../)

Problem
In go.mod file I wrote:
module github.com/Siiir/vector
go 1.17
require github.com/huandu/go-clone v1.3.2 // indirect
replace clone => github.com/huandu/go-clone[v1.3.2]
It says that I cannot do such a replacement.
I actually solved my problem with the name of imported package.
It is convenient & working without that dash. I found that I can use clone.something to refer to a function.
No need to type go-clone.something.
Anyway, assume that a package name is indeed crazy or inconvenient. How can I replace it?
What I've seen:
I've seen a sibling question:
go modules - replace does not work - replacement module without version must be directory path (rooted or starting with
What I tried:
Working with terminal:
go mod edit -replace=clone=github.com/huandu/go-clone
got: go: -replace=clone=github: unversioned new path must be local directory
manual editing:
Attempts like: replace clone => github.com/huandu/go-clone[v1.3.2]
got: replacement module without version must be directory path (rooted or starting with ./ or ../)
Anyway, assume that a package name is indeed crazy or inconvenient. How can I replace it?
You cannot.
And you should not. The import path is something you write just once in the import declaration and the package name can be changed on a per file level with import nicename "something.you.think/is-totally/inconvenient/and/unacceptable-to/your_taste" .

Build issue angular 5 has no exported member 'DSVRowAny'

ERROR in node_modules/#types/d3-fetch/index.d.ts(9,10): error TS2305: Module '"F:/AprotechSolutions/ems-beam-webapp/node_modules/#types/d3-dsv/index"' has no exported member
'DSVParsedArray'.
node_modules/#types/d3-fetch/index.d.ts(9,26): error TS2305: Module '"node_modules/#types/d3-dsv/index"' has no exported member 'DSVRowString'.
node_modules/#types/d3-fetch/index.d.ts(9,40): error TS2305: Module '"/node_modules/#types/d3-dsv/index"' has no exported member 'DSVRowAny'.
node_modules/#types/d3-fetch/index.d.ts(9,57): error TS2497: Module '"/node_modules/#types/d3-dsv/index"' resolves to a non-module entity
and cannot be imported using this construct.
node_modules/#types/d3/index.d.ts(24,15): error TS2498: Module '"/node_modules/#types/d3-dsv/index"' uses 'export =' and cannot be used with 'export *'.
Seems, this issue due to update
https://www.npmjs.com/package/#types/d3-dsv/v/0.4.4?activeTab=versions
I have this problem too.
Try to fix lib version to 1.0.31 in your package.json
"devDependencies": {
"#types/d3-dsv": "1.0.31"
}
It looks like the issue may have been the "latest" tag for #types/d3-dsv switching from the 1.0.x versions (that contain exports for DSVRowString etc.) to 0.4.x (that don't), as described in this GitHub issue. Hopefully there will be a response to the issue that will remove the need for the version pinning.
So, at least for me, it was enough to pin to the latest 1.x.x version, and not necessary to lock to previous version (as suggested in another answer), e.g:
"devDependencies": {
"#types/d3-dsv": "^1.0.32"
}
Update (28/05/18):
Looks like the issue is temporarily resolved due to the release of version 1.0.33 causing the "latest" tag to point back to the 1.0.x branch. However, as per a comment on the GitHub issue this isn't necessarily a permanent fix, and another release of the 0.4.x code could cause the same issue.
It seems to be resolved, I just built my application without any problems any without the devDependencies for d3-dsv.
There is was an update to the package a couple of hours ago:
https://www.npmjs.com/package/#types/d3-dsv/v/0.4.4?activeTab=versions

Import of valid bna file into Composer Playground 0.9 fails

I have a business network I've been working with for a few weeks, and the bna file has been deployed successfully to multiple versions of hyperledger fabric. Suddenly it will not import into composer-playground 0.9, and attempts to run
composer archive create
throw this error:
IllegalModelException: Class ApproveMedication is not declared as abstract. It must define an identifying field. File '/Users/dwakeman/git/pharma-network/models/com.ibm.pharma.cto': line 92 column 1, to line 102 column 2.
The transaction is defined in my model like this:
transaction ApproveMedication {
o String productNdc
o String proprietaryName
o String nonProprietaryName
o String labelerName
o String dosageForm
o String route
o String strength
o String productTypeName
o String deaClassification
}
I am running the latest version of composer-cli:
composer-cli v0.9.0
composer-admin v0.9.0
composer-client v0.9.0
composer-common v0.9.0
composer-runtime-hlf v0.9.0
composer-runtime-hlfv1 v0.9.0
I know that composer 0.9 introduced some changes in this area, as indicated in the release notes:
I have removed the fields as recommended, but it still fails. Does anybody know what is happening?
Thanks!
Okay, I figured out what I was doing wrong. I recently refactored my business network by following the Developer Tutorial in the Composer documentation.
When you do that and then run
npm install
to build your application to produce the bna file, it creates a directory in your project folder called node_modules that contains code specific to the business network. I forgot to delete that code, and that's what was causing my issue.
To solve the problem I deleted the node_modules directory and ran
npm install
again. Once I did that I was able to import the generated bna file into Composer Playground.

go install third part package, unrecognized import path

Detail:
C:\>go get -u github.com/hidu/proxy-manager
package code.google.com/p/go.net/proxy: Get http://www.google.com/hangouts/: stopped after 10 redirects
package golang.org/x/crypto/blowfish: unrecognized import path "golang.org/x/crypto/blowfish"
package golang.org/x/crypto/cast5: unrecognized import path "golang.org/x/crypto/cast5"
package golang.org/x/crypto/salsa20/salsa: unrecognized import path "golang.org/x/crypto/salsa20/salsa"
I think maybe it because google is forbidden in china?
How to solve this error?
I opened a issue here, solved by the help of repo owner.
The package I try to install is using godep and go vendor.
go vendor need go 1.5 +, and the most important thing is :
export GO15VENDOREXPERIMENT=1
This command make install successful.
Maybe it is also because code.google.com/p/go.net has been archived.
Make sure the project you are using includes a recent fork of that go.net project, like github.com/hashicorp/go.net.
If you cannot change directly github.com/hidu/proxy-manager, you would need to fork it first.
Then change the import in hidu/proxy-manager/manager/client.go#L4
For the "unrecognized import path", see this thread:
One common explanation is that something is blocking access to the golang.org domain.
go get -v golang.org/x/crypto/blowfish should tell you more.
That last part works for me:
C:\Users\vonc\prog>go get -v golang.org/x/crypto/blowfish
Fetching https://golang.org/x/crypto/blowfish?go-get=1
Parsing meta tags from https://golang.org/x/crypto/blowfish?go-get=1 (status code 200)
get "golang.org/x/crypto/blowfish": found meta tag
main.metaImport{Prefix:"golang.org/x/crypto",
VCS:"git",
RepoRoot:"https://go.googlesource.com/crypto"}
at https://golang.org/x/crypto/blowfish?go-get=1
get "golang.org/x/crypto/blowfish": verifying non-authoritative meta tag
Fetching https://golang.org/x/crypto?go-get=1
Parsing meta tags from https://golang.org/x/crypto?go-get=1 (status code 200)
golang.org/x/crypto (download)
golang.org/x/crypto/blowfish
Trying proxy
export GO111MODULE=on
export GOPROXY=https://goproxy.cn

Resources