Unable to include as component in another package
jeswr opened this issue Β· comments
Issue type:
- π Bug
Description:
To give context: this is an error I have been running into, in trying to set up a sparql-reasoning-link-traversal
init
actor in the comunica-feature-reasoning
repo.
When trying to run comunica-compile-config
with the following config-default.json
, it is unable to detect the context.jsonld
for link traversal (error message below).
{
"@context": [
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-init-sparql/^1.0.0/components/context.jsonld",
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-init-sparql-link-traversal/^0.0.0/components/context.jsonld",
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/runner/^1.0.0/components/context.jsonld"
],
"@id": "urn:comunica:my",
"@type": "Runner",
"import": [
]
}
Detected remote context lookup for 'https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-init-sparql-link-traversal/^0.0.0/components/context.jsonld' in config/config-default.json. This may indicate a missing or invalid dependency, or an invalid context URL.
This is possibly a components.js issue with the package not handling the ^0.0.2-alpha.e75a15a.0
version number well.
Thanks for reporting!
That should work in theory though (but haven't tested this myself).
Do you see any other error messages?
Such an error usually points to the package not being present in node_modules
.
Such an error usually points to the package not being present in node_modules.
I've checked node_modules
and it is present in there. I have a demo repo with the conditions for this error here
Do you see any other error messages?
The full log is
jeswr@pop-os:~/Documents/GitHub/fail-link-traversal-install-demo$ npm install
> fail-link-traversal-install-demo@1.0.0 prepare
> comunica-compile-config config.json > engine-default.js
2022-01-12T23:56:13.950Z [Components.js] warn: Detected remote context lookup for 'https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-init-sparql-link-traversal/^0.0.0/components/context.jsonld' in config.json. This may indicate a missing or invalid dependency, or an invalid context URL.
Error: Error while parsing file "config.json": Failed to load remote context https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-init-sparql-link-traversal/^0.0.0/components/context.jsonld: Internal Server Error
at Function.addPathToError (/home/jeswr/Documents/GitHub/fail-link-traversal-install-demo/node_modules/componentsjs/lib/rdf/RdfParser.js:73:16)
at PassThrough.<anonymous> (/home/jeswr/Documents/GitHub/fail-link-traversal-install-demo/node_modules/componentsjs/lib/rdf/RdfParser.js:46:38)
at PassThrough.emit (node:events:402:35)
at JsonLdParser.<anonymous> (/home/jeswr/Documents/GitHub/fail-link-traversal-install-demo/node_modules/rdf-parse/lib/RdfParser.js:71:47)
at JsonLdParser.emit (node:events:402:35)
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
npm ERR! code 1
npm ERR! path /home/jeswr/Documents/GitHub/fail-link-traversal-install-demo
npm ERR! command failed
npm ERR! command sh -c comunica-compile-config config.json > engine-default.js
npm ERR! A complete log of this run can be found in:
npm ERR! /home/jeswr/.npm/_logs/2022-01-12T23_56_17_300Z-debug.log
Looks like the problem is that the components folder isn't getting included in the npm distribution of the package.
This is all that gets installed in my node_modules
Because it is not included in the package.json
files
"files": [
"config",
"bin/**/*.d.ts",
"bin/**/*.js",
"index.js",
"index.d.ts",
"index-browser.d.ts",
"index-browser.js",
"engine-default.js"
],
Looks like it is included in the package.json on this repo though, so creating a new release should solve this
Aha, great detective work!
Published new versions as 0.0.2-alpha.e74249a.0
.
That version is available though. It just doesn't show up as latest on npm because of the custom version identifiers. Using the mentioned version in your package.json should work.