Errors due to inconsistent workspace
Closed this issue · 1 comments
- Release number or git hash: e453f4b
- Web browser version and OS: Windows, Chrome 77
- Environment (local or deployed): Windows, local
Steps to reproduce
yo phovea:setup-workspace caleydo/gapminder_product
npm install
docker-compose up
npm start
- Open http://localhost:8080
Observed behavior
Error in browser console:
template.ts:154 Uncaught TypeError: Cannot read property 'node' of undefined
at CLUEWrapper.buildImpl (template.ts:154)
at CLUEWrapper.ACLUEWrapper.build (ACLUEWrapper.ts:67)
at new CLUEWrapper (template.ts:89)
at Object.create [as a] (template.ts:180)
at Object.<anonymous> (index.ts:23)
at __webpack_require__ (bootstrap c72e7ffb1683f647db5c:52)
at Object.<anonymous> (phovea.js:11)
at __webpack_require__ (bootstrap c72e7ffb1683f647db5c:52)
at webpackJsonpCallback (bootstrap c72e7ffb1683f647db5c:23)
at app.js:5
CLUEWrapper.buildImpl @ template.ts:154
ACLUEWrapper.build @ ACLUEWrapper.ts:67
CLUEWrapper @ template.ts:89
create @ template.ts:180
(anonymous) @ index.ts:23
__webpack_require__ @ bootstrap c72e7ffb1683f647db5c:52
(anonymous) @ phovea.js:11
__webpack_require__ @ bootstrap c72e7ffb1683f647db5c:52
webpackJsonpCallback @ bootstrap c72e7ffb1683f647db5c:23
(anonymous) @ app.js:5
ProvenanceGraph.ts:549 Uncaught (in promise) TypeError: Cannot read property '_resolvesTo' of undefined
at ProvenanceGraph.findOrAddObjectImpl (ProvenanceGraph.ts:549)
at ProvenanceGraph.findOrAddObject (ProvenanceGraph.ts:536)
at template.ts:133
Expected behavior
- Gapminder should run
After investigating the problem, I found two things:
1. Error in _template.ts
This bug was fixed with phovea/phovea_clue@fb54662 and released with phovea_clue@2.0.1.
Solution
Checkout the tag v2.0.1 for the phovea_clue repo in the workspace. I updated the version in 6593be4.
2. Inconsistent workspace
The generator clones the exact v2.0.0 of phovea_clue, because it is part of the additional server dependencies defined in the phovea_product.json:
gapminder_product/phovea_product.json
Lines 30 to 34 in e453f4b
However, the gapminder package.json allows also newer versions phovea dependencies:
{
"dependencies": {
"phovea_core": "^2.0.0",
"phovea_vis": "^2.0.0",
"phovea_d3": "^2.0.0",
"phovea_ui": "^2.0.0",
"phovea_clue": "^2.0.0"
}
}
The generator creates a merged package.json for the workspace, which removes even some of the caret ranges:
{
"dependencies": {
"phovea_core": "2.0.0",
"phovea_vis": "^2.0.0",
"phovea_d3": "^2.0.0",
"phovea_ui": "2.0.0"
}
}
At the end the workspace dependencies look like this:
- npm dependencies:
- phovea_core@2.0.0
- phovea_d3@2.1.0 -> phovea_core@2.1.2
- phovea_ui@2.0.0 -> phovea_core@2.0.0
- phovea_vis@2.1.0 -> phovea_core@2.1.2
- as repo in workspace:
- phovea_clue@2.0.1 -> phovea_core@2.0.0, phovea_ui@2.0.0
As phovea_d3 and phovea_vis require phovea_core in a newer version it leads to an inconsistent workspace.
Solution
- Option 1: Pin versions in Gapminder to the patch level (tilde ranges), or even pin the phovea version to v2.0.0
- Option 2: Allow caret ranges in phovea_product.json, so that they match the npm dependencies. See also the feature request in phovea/generator-phovea#144.
For now I implemented Option 1 using the tilde ranges for the Gapminder dependencies.