Hey,
I recently tried to start a new project using VTK.js.
Using the latest node and NPM from their debian repos on debian stable, the ES6 tutorial from the vtk.js docs failed at the step
> npm install kw-web-suite --save-dev
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: webpack@5.26.3
npm ERR! node_modules/webpack
npm ERR! peer webpack@"^5.1.0" from terser-webpack-plugin@5.1.1
npm ERR! node_modules/terser-webpack-plugin
npm ERR! terser-webpack-plugin@"^5.1.1" from webpack@5.26.3
npm ERR! peer webpack@"^4.0.0 || ^5.0.0" from worker-loader@3.0.7
npm ERR! node_modules/worker-loader
npm ERR! worker-loader@"3.0.7" from vtk.js@16.13.0
npm ERR! node_modules/vtk.js
npm ERR! vtk.js@"^16.13.0" from the root project
npm ERR! 11 more (babel-loader, clean-webpack-plugin, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer webpack@"^1.12.9 || ^2.2.0 || ^3.x || ^4.x" from parallel-webpack@2.6.0
npm ERR! node_modules/parallel-webpack
npm ERR! parallel-webpack@"2.6.0" from kw-web-suite@11.1.0
npm ERR! node_modules/kw-web-suite
npm ERR! dev kw-web-suite@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /home/nicoco/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/nicoco/.npm/_logs/2021-03-19T16_44_48_545Z-debug.log
I managed to get something up and running by using vtkjs@beta
and replacing --colors
by --color
in the package.json
scripts section.
From there I could npm run build
and enjoy vtk.js. However I did not manage to adapt the start script line to work in this context. I tried webpack serve --content-base ./dist
but…
> npm start
> vtkjsboilerplate@1.0.0 start
> webpack serve --content-base ./dist
/home/nicoco/src/vtkjsboilerplate/node_modules/webpack-cli/lib/utils/resolve-command.js:33
return mod(...args);
^
TypeError: Class constructor ServeCommand cannot be invoked without 'new'
at run (/home/nicoco/src/vtkjsboilerplate/node_modules/webpack-cli/lib/utils/resolve-command.js:33:12)
at Command.<anonymous> (/home/nicoco/src/vtkjsboilerplate/node_modules/webpack-cli/lib/utils/arg-parser.js:34:58)
at Command.listener [as _actionHandler] (/home/nicoco/src/vtkjsboilerplate/node_modules/commander/index.js:426:31)
at Command._parseCommand (/home/nicoco/src/vtkjsboilerplate/node_modules/commander/index.js:1002:14)
at Command._dispatchSubcommand (/home/nicoco/src/vtkjsboilerplate/node_modules/commander/index.js:953:18)
at Command._parseCommand (/home/nicoco/src/vtkjsboilerplate/node_modules/commander/index.js:970:12)
at Command.parse (/home/nicoco/src/vtkjsboilerplate/node_modules/commander/index.js:801:10)
at argParser (/home/nicoco/src/vtkjsboilerplate/node_modules/webpack-cli/lib/utils/arg-parser.js:164:27)
at runCLI (/home/nicoco/src/vtkjsboilerplate/node_modules/webpack-cli/lib/bootstrap.js:11:24)
at Object.<anonymous> (/home/nicoco/src/vtkjsboilerplate/node_modules/webpack-cli/bin/cli.js:24:5)
This raises a few questions:
- Is there an easy solution to get a dev environment with the latest stable vtk.js (I don’t particularly want to use the latest beta, but it’s OK if everything else is broken)
- If not, is there a way to fix the start script to get a webpack dev server working?
- What is the recommended approach to start developing a (small) vtk.js app these days?
Thanks for reading me!