collective / volto-form-block

Volto addon for a customizable form block
MIT License
9 stars 8 forks source link

Can't install from documentation #45

Open gustavoaborges opened 2 years ago

gustavoaborges commented 2 years ago

I'm trying to install with yarn add volto-form-blockon a cookiecutter installation and I get the following message

yarn add v1.22.19
$ if [ -f $(pwd)/mrs.developer.json ]; then if [ -f $(pwd)/node_modules/.bin/missdev ]; then yarn develop; else yarn develop:npx; fi; fi
yarn run v1.22.19
$ missdev --config=jsconfig.json --output=addons --fetch-https

Using src/addons
Update paths in tsconfig.json

✨  Done in 0.33s.
error Running this command will add the dependency to the workspace root rather than the workspace itself, which might not be what you want - if you really meant it, make it explicit by running this command again with the -W flag (or --ignore-workspace-root-check).
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

I then tried yarn add volto-form-block -W, followed by make build-frontend. When I run make start-frontend I get the following error:

yarn run v1.22.19
$ razzle start
 WAIT  Compiling...

✔ Client
  Compiled successfully in 470.57ms

✔ Server
  Compiled successfully in 5.84s

/Users/gustavoborges/Documents/projects/ifabr/ifa-br/frontend/build/webpack:/node_modules/@plone/volto/src/config/server.js:8
  expressMiddleware: [
^
TypeError: Object(...) is not a function
    at /Users/gustavoborges/Documents/projects/ifabr/ifa-br/frontend/node_modules/@plone/volto/src/express-middleware/devproxy.js:44:1
    at Module../node_modules/@plone/volto/src/config/server.js (/Users/gustavoborges/Documents/projects/ifabr/ifa-br/frontend/build/webpack:/node_modules/@plone/volto/src/config/server.js:8:1)
    at __webpack_require__ (/Users/gustavoborges/Documents/projects/ifabr/ifa-br/frontend/build/webpack:/webpack/bootstrap:754:1)
    at fn (/Users/gustavoborges/Documents/projects/ifabr/ifa-br/frontend/build/webpack:/webpack/bootstrap:59:1)
    at Module../node_modules/@plone/volto/src/config/index.js (/Users/gustavoborges/Documents/projects/ifabr/ifa-br/frontend/build/webpack:/node_modules/@plone/volto/src/config/index.js:63:1)
    at __webpack_require__ (/Users/gustavoborges/Documents/projects/ifabr/ifa-br/frontend/build/webpack:/webpack/bootstrap:754:1)
    at fn (/Users/gustavoborges/Documents/projects/ifabr/ifa-br/frontend/build/webpack:/webpack/bootstrap:59:1)
    at Module../node_modules/@plone/volto/src/server.jsx (/Users/gustavoborges/Documents/projects/ifabr/ifa-br/frontend/build/server.js:118604:77)
    at __webpack_require__ (/Users/gustavoborges/Documents/projects/ifabr/ifa-br/frontend/build/webpack:/webpack/bootstrap:754:1)
    at fn (/Users/gustavoborges/Documents/projects/ifabr/ifa-br/frontend/build/webpack:/webpack/bootstrap:59:1)
sswp> !!! Script exited with code 1
gustavoaborges commented 2 years ago

I'm also unable to install it with yo @plone/volto on a dockerfile

RUN yo @plone/volto \
    plone-frontend \
    --description "Plone frontend using Volto" \
    --addon "@eeacms/volto-listing-block" \
    --addon "volto-form-block" \
    --skip-install \
    --skip-workspaces \
    --volto=${VOLTO_VERSION} \
    --no-interactive

RUN cd plone-frontend \
    && yarn install \
    && yarn build
#14 256.3 success Saved lockfile.
#14 256.3 $ yarn omelette && yarn patches
#14 256.5 yarn run v1.22.19
#14 256.5 $ if [ ! -d omelette ]; then ln -sf node_modules/@plone/volto omelette; fi
#14 256.6 Done in 0.05s.
#14 256.7 yarn run v1.22.19
#14 256.7 $ /bin/bash patches/patchit.sh > /dev/null 2>&1 ||true
#14 256.8 Done in 0.06s.
#14 256.8 Done in 256.27s.
#14 257.9 yarn run v1.22.19
#14 257.9 $ razzle build --noninteractive
#14 259.9 /build/plone-frontend/node_modules/@plone/scripts/node_modules/razzle/scripts/build.js:10
#14 259.9   throw err;
#14 259.9   ^
#14 259.9 
#14 259.9 TypeError: Cannot destructure property 'include' of 'options.webpackOptions.babelRule' as it is undefined.
#14 259.9     at defaultModify (/build/plone-frontend/node_modules/@plone/volto/razzle.config.js:234:11)
#14 259.9     at modifyWebpackConfig (/build/plone-frontend/node_modules/@plone/volto/razzle.config.js:317:27)
#14 259.9     at /build/plone-frontend/node_modules/@plone/scripts/node_modules/razzle/config/createConfigAsync.js:1023:22
#14 259.9 error Command failed with exit code 1.
#14 259.9 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
avoinea commented 2 years ago

@pnicolli Same here: @plone/volto@16.0.0-alpha.44

/frontend/build/webpack:/node_modules/@plone/volto/src/config/server.js:8
  expressMiddleware: [
^
TypeError: Object(...) is not a function...
avoinea commented 2 years ago

@pnicolli Also when using upgrade_to_volto16 branch

avoinea commented 2 years ago

@pnicolli Ok, this is because of dependency: volto-subblocks.

You need to merge and release:

Also update the dependency:

We usually use * in add-ons, and pin them in volto-projects. Otherwise it's a nightmare with this version pins.

pnicolli commented 2 years ago

Yeah, working on some testing myself these days, there are several things to put together as I am working on updating several add-ons.

Regarding the dependency, I would suggest (and will probably also try asap) using peer dependencies in order to delegate version choice in the volto project, so you can also trigger warning for improper version choices.

pnicolli commented 2 years ago

Meanwhile, I moved volto-subblocks to peer dependencies in the upgrade_to_volto16 branch, in order to continue testing.

pnicolli commented 2 years ago

Released version 3.0.0 of this add-on with the aforementioned PRs released. Currently testing it myself, I'll keep you posted.

pnicolli commented 2 years ago

From the first manual tests, version 3.0.0 of the add-on seems to be working. I'm currently testing plone 6.0.0b3 with volto 16.0.0-alpha.45. Let me know if the issue is solved or if you find any other problems. Thanks

tiberiuichim commented 1 year ago

I don't understand why we're dealing with this problem.

Of course, we also have yarn as a saboteur. I have found that the problem with the express middleware is that the webpack-dev-server depends on http-proxy-middleware 0.19, while Volto wants a 2.0.1 release. But hoisting and everything gets the wrong version in the top level. So in my project I pinned http-proxy-middleware in package.json:

  "resolutions": {
    "http-proxy-middleware": "2.0.1"
  },