wmr icon indicating copy to clipboard operation
wmr copied to clipboard

rollup version is too old (is fake)

Open Aloento opened this issue 3 years ago β€’ 23 comments

"@wmrjs/service-worker@^0.3.1":
  version "0.3.1"
  dependencies:
    rollup "^2.0.0"
rollup@^2.0.0:
  version "2.70.1"

then "@rollup/plugin-commonjs" requires at least [email protected] but found [email protected]. Cannot fix this by yarn add -D rollup

I recommend you to use the dependence bot or npm-check-updates to keep new for your deps.

Aloento avatar Apr 12 '22 17:04 Aloento

We're using Rollup 2.52.7:

https://github.com/preactjs/wmr/blob/caf7ff840363351b0f52eabf1eff91c3e9888c04/packages/wmr/package.json#L81

Our deps are all inlined, so if you have rollup in your lock file then it hasn't come from installing WMR.

rschristian avatar Apr 12 '22 21:04 rschristian

I know wmr is new but my old rollup is from your package @wmrjs/service-worker It's also your package, or maybe you don't maintain this package, then I will remove it.

Aloento avatar Apr 12 '22 21:04 Aloento

Your lock file clearly shows it resolving to 2.70, so I don't know what is referring to 2.8, but it's not us I don't think.

rschristian avatar Apr 12 '22 21:04 rschristian

Yes, I am also confused about this. I try to look for the node_modules and see what exactly the version is. And it's the newest version of rollup but, the plug-in always says it's the old version. I use a new project and I will show you the debug things.

Aloento avatar Apr 12 '22 21:04 Aloento

SoarT@Soar-Blade ~\Downloads\WMR ❯❯❯ yarn run start
Debugger attached.
yarn run v1.22.18
$ wmr
Debugger attached.

Error: Insufficient Rollup version: "@rollup/plugin-commonjs" requires at least [email protected] but found [email protected].
    at validateRollupVersion (C:\Users\SoarT\Downloads\WMR\node_modules\@rollup\plugin-commonjs\dist\index.js:682:11)
    at Object.buildStart (C:\Users\SoarT\Downloads\WMR\node_modules\@rollup\plugin-commonjs\dist\index.js:1791:7)
    at C:\Users\SoarT\Downloads\WMR\node_modules\wmr\wmr.cjs:2:2973713
    at Array.map (<anonymous>)
    at Object.buildStart (C:\Users\SoarT\Downloads\WMR\node_modules\wmr\wmr.cjs:2:2973677)
    at Dwt (C:\Users\SoarT\Downloads\WMR\node_modules\wmr\wmr.cjs:2:3009029)
    at eDt (C:\Users\SoarT\Downloads\WMR\node_modules\wmr\wmr.cjs:2:3021787)
    at async Zwt (C:\Users\SoarT\Downloads\WMR\node_modules\wmr\wmr.cjs:2:3021244)

Waiting for the debugger to disconnect...
error Command failed with exit code 1.

image image

Aloento avatar Apr 12 '22 21:04 Aloento

Why are you installing @rollup/plugin-commonjs out of curiosity? I could not reproduce the error locally when adding @wmrjs/service-worker to an app.

rschristian avatar Apr 12 '22 21:04 rschristian

reproduce this error just with yarn add @rollup/plugin-commonjs

wmr.config.mjs import commonjs from "@rollup/plugin-commonjs"; plugins: [commonjs()],

then you cannot start wmr.

I'm trying to solve this problem so I add @rollup/plugin-commonjs Currently, I can't use WMR to working my project at all.

Aloento avatar Apr 12 '22 21:04 Aloento

Hm, still cannot reproduce that error. Can you clear node_modules and your lock file and try installing again? What version of Yarn are you using? I'm on 1.22.18 which seems to be working.

All I've done is create a new project, add that plugin, and add it to the config. Is that a correct reproduction?

rschristian avatar Apr 12 '22 21:04 rschristian

Let me clean everything and restart my computer, then see what will happen.


Ok, still wrong...

Let me use Linux to try again.


Not working.... outrageous

Aloento avatar Apr 12 '22 21:04 Aloento

Can you try cloning and running this?

https://github.com/rschristian/wmr-rollup-cjs

Try installing with yarn --frozen-lockfile

rschristian avatar Apr 12 '22 21:04 rschristian

this is my env, I will try yours. https://github.com/Aloento/WMR


Still wrong... I suspect there may be something wrong with my environment. Let me open a virtual machine and try it.

Aloento avatar Apr 12 '22 21:04 Aloento

I'm on Linux,, using Yarn v1 (1.22.18), if it helps. Bizarre issue.

rschristian avatar Apr 12 '22 22:04 rschristian

Still wrong in clean Win 11 virtual machine (Sandbox). With nodejs 17.9.0 and yarn v1.22.18 I now try with Linux virtual machine.


Still wrong... omg...

Aloento avatar Apr 12 '22 22:04 Aloento

I'm on Node 14.19.1, though I don't think anything's really changed there.

rschristian avatar Apr 12 '22 22:04 rschristian

I tried with your node version and it's started but still thrown... funny...

(node:6804) UnhandledPromiseRejectionWarning: Error: Insufficient Rollup version: "@rollup/plugin-commonjs" requires at least [email protected] but found [email protected].
    at validateRollupVersion (C:\Users\WDAGUtilityAccount\Desktop\wmr-rollup-cjs-master\node_modules\@rollup\plugin-commonjs\dist\index.js:682:11)
    at Object.buildStart (C:\Users\WDAGUtilityAccount\Desktop\wmr-rollup-cjs-master\node_modules\@rollup\plugin-commonjs\dist\index.js:1791:7)
    at C:\Users\WDAGUtilityAccount\Desktop\wmr-rollup-cjs-master\node_modules\wmr\wmr.cjs:2:2973713
    at Array.map (<anonymous>)
    at Object.buildStart (C:\Users\WDAGUtilityAccount\Desktop\wmr-rollup-cjs-master\node_modules\wmr\wmr.cjs:2:2973677)
    at Dwt (C:\Users\WDAGUtilityAccount\Desktop\wmr-rollup-cjs-master\node_modules\wmr\wmr.cjs:2:3009029)
    at eDt (C:\Users\WDAGUtilityAccount\Desktop\wmr-rollup-cjs-master\node_modules\wmr\wmr.cjs:2:3021787)
    at async Zwt (C:\Users\WDAGUtilityAccount\Desktop\wmr-rollup-cjs-master\node_modules\wmr\wmr.cjs:2:3021244)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:6804) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:6804) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

  πŸ‘©β€πŸš€ WMR dev server running at:

  Local:   http://localhost:8080
  Network: (disabled, see --host)

And the page cannot be showing.

I'm giving up.

Aloento avatar Apr 12 '22 22:04 Aloento

Shoot, I'm really sorry, I didn't notice you were running the dev server.

I can reproduce there. Can you confirm that wmr build doesn't result in that error?

rschristian avatar Apr 12 '22 22:04 rschristian

SoarT@Soar-Blade ~\Downloads\WMR git:ξ‚ master ❯❯❯ yarn run build
Debugger attached.
yarn run v1.22.18
$ wmr build --prerender
Debugger attached.

SyntaxError: Unexpected token: punc (:)
  1 | …
> 2 | …pos=i}}function nd(e,t,n,r,i){throw new td(e,t,n,r,i)}function rd(e,t,n){…
    |                                      ^

    at nd (C:\Users\SoarT\Downloads\WMR\node_modules\wmr\wmr.cjs:2:399363)
    at B (C:\Users\SoarT\Downloads\WMR\node_modules\wmr\wmr.cjs:2:408097)
    at c (C:\Users\SoarT\Downloads\WMR\node_modules\wmr\wmr.cjs:2:408188)
    at l (C:\Users\SoarT\Downloads\WMR\node_modules\wmr\wmr.cjs:2:408241)
    at m (C:\Users\SoarT\Downloads\WMR\node_modules\wmr\wmr.cjs:2:408780)
    at _ (C:\Users\SoarT\Downloads\WMR\node_modules\wmr\wmr.cjs:2:412876)
    at e (C:\Users\SoarT\Downloads\WMR\node_modules\wmr\wmr.cjs:2:409997)
    at C:\Users\SoarT\Downloads\WMR\node_modules\wmr\wmr.cjs:2:408887
    at E (C:\Users\SoarT\Downloads\WMR\node_modules\wmr\wmr.cjs:2:412606)
    at e (C:\Users\SoarT\Downloads\WMR\node_modules\wmr\wmr.cjs:2:409993)

Waiting for the debugger to disconnect...
error Command failed with exit code 1.

Aloento avatar Apr 12 '22 22:04 Aloento

Well... different error is progress?

rschristian avatar Apr 12 '22 22:04 rschristian

The official Rollup commonjs plugin won't work with WMR's dev server, because it's not a full Rollup implementation. The version number is fake, but even if that were updated this wouldn't work - it's missing things like the plugin metadata API. Also, the way the CommonJS plugin works is extremely complex and retains data across multiple plugin passes, which does not work with the model WMR uses where each file is an individual HTTP request.

That error looks like TypeScript is being authored in a non-TypeScript file (.js or .mjs).

developit avatar Apr 12 '22 22:04 developit

uh... I didn't write any type... https://github.com/preactjs/wmr/issues/922 should reopen... So do you have any solution for the commonjs?

Aloento avatar Apr 12 '22 22:04 Aloento

@developit Interestingly the package that's throwing the error (react-helmet-async) is one built with Microbundle.... Granted might be in one of the deps, the error position doesn't exactly make it clear.

rschristian avatar Apr 12 '22 22:04 rschristian

@rschristian I thought it was because of the scheduler package?

developit avatar Apr 13 '22 03:04 developit

They've had two separate issues with two separate packages:

  • @fluentui/react-components leads to scheduler
  • react-helmet-async leads to the above Unexpected punc (:). As for where that token is, no clue, as we don't seem to create a stack trace that actually identifies where it's from.

rschristian avatar Apr 13 '22 03:04 rschristian