vaadin / platform

Vaadin platform 10+ is a Java web development platform based on Vaadin web components. If you don't know to which repository your bug report should be filed, use this and we'll move it to the right one.
https://vaadin.com
515 stars 76 forks source link

Package lock file from new Vaadin 24 projects triggers a bug in npm 9 #3645

Closed flozano closed 1 year ago

flozano commented 1 year ago

Describe the bug

in start.vaadin.com, when you generate an app with vaadin v24 (pre):

image

and try to run it, you get:

image

and npm result is:

~/Downloads/my-app 2  main ❯ npm install
npm ERR! Unable to resolve reference $@polymer/polymer

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/flozano/.npm/_logs/2023-01-05T17_14_03_870Z-debug-0.log
~/Downloads/my-app 2  main ❯ cat /Users/flozano/.npm/_logs/2023-01-05T17_14_03_870Z-debug-0.log
0 verbose cli /opt/homebrew/Cellar/node/19.3.0/bin/node /opt/homebrew/bin/npm
1 info using npm@9.2.0
2 info using node@v19.3.0
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 1ms
5 timing config:load:file:/opt/homebrew/lib/node_modules/npm/npmrc Completed in 2ms
6 timing config:load:builtin Completed in 2ms
7 timing config:load:cli Completed in 1ms
8 timing config:load:env Completed in 1ms
9 timing config:load:file:/Users/flozano/Downloads/my-app 2/.npmrc Completed in 1ms
10 timing config:load:project Completed in 3ms
11 timing config:load:file:/Users/flozano/.npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:/opt/homebrew/etc/npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:setEnvs Completed in 0ms
16 timing config:load Completed in 8ms
17 timing npm:load:configload Completed in 8ms
18 timing npm:load:mkdirpcache Completed in 0ms
19 timing npm:load:mkdirplogs Completed in 0ms
20 verbose title npm install
21 verbose argv "install"
22 timing npm:load:setTitle Completed in 3ms
23 timing config:load:flatten Completed in 1ms
24 timing npm:load:display Completed in 1ms
25 verbose logfile logs-max:10 dir:/Users/flozano/.npm/_logs/2023-01-05T17_14_03_870Z-
26 verbose logfile /Users/flozano/.npm/_logs/2023-01-05T17_14_03_870Z-debug-0.log
27 timing npm:load:logFile Completed in 2ms
28 timing npm:load:timers Completed in 0ms
29 timing npm:load:configScope Completed in 0ms
30 timing npm:load Completed in 14ms
31 silly logfile start cleaning logs, removing 1 files
32 timing config:load:flatten Completed in 0ms
33 timing arborist:ctor Completed in 1ms
34 silly logfile done cleaning log files
35 timing idealTree:init Completed in 168ms
36 timing idealTree:userRequests Completed in 1ms
37 silly idealTree buildDeps
38 silly fetch manifest @vaadin-component-factory/vcf-nav@1.0.6
39 http fetch GET 200 https://registry.npmjs.org/@vaadin-component-factory%2fvcf-nav 14ms (cache hit)
40 silly fetch manifest line-awesome@1.3.0
41 http fetch GET 200 https://registry.npmjs.org/line-awesome 2ms (cache hit)
42 silly placeDep ROOT @vaadin-component-factory/vcf-nav@1.0.6 OK for:  want: 1.0.6
43 silly placeDep ROOT line-awesome@1.3.0 OK for:  want: 1.3.0
44 silly fetch manifest @vaadin/vaadin-lumo-styles@^v23.0.0
45 http fetch GET 200 https://registry.npmjs.org/@vaadin%2fvaadin-lumo-styles 3ms (cache hit)
46 timing idealTree:#root Completed in 32ms
47 timing idealTree Completed in 201ms
48 timing command:install Completed in 204ms
49 verbose stack Error: Unable to resolve reference $@polymer/polymer
49 verbose stack     at get spec [as spec] (/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/edge.js:186:15)
49 verbose stack     at OverrideSet.getEdgeRule (/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/override-set.js:53:34)
49 verbose stack     at Edge.reload (/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/edge.js:228:46)
49 verbose stack     at [_setFrom] (/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/edge.js:266:10)
49 verbose stack     at new Edge (/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/edge.js:85:19)
49 verbose stack     at [_loadDepType] (/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/node.js:890:9)
49 verbose stack     at [Arborist.Node._loadDeps] (/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/node.js:867:23)
49 verbose stack     at new Node (/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/node.js:259:20)
49 verbose stack     at <computed>.then.error.requiredBy (/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1250:20)
49 verbose stack     at async [nodeFromEdge] (/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1058:19)
50 verbose cwd /Users/flozano/Downloads/my-app 2
51 verbose Darwin 21.6.0
52 verbose node v19.3.0
53 verbose npm  v9.2.0
54 error Unable to resolve reference $@polymer/polymer
55 verbose exit 1
56 timing npm Completed in 229ms
57 verbose unfinished npm timer reify 1672938843894
58 verbose unfinished npm timer reify:loadTrees 1672938843894
59 verbose unfinished npm timer idealTree:buildDeps 1672938844064
60 verbose unfinished npm timer idealTree:node_modules/@vaadin-component-factory/vcf-nav 1672938844096
61 verbose code 1
62 error A complete log of this run can be found in:
62 error     /Users/flozano/.npm/_logs/2023-01-05T17_14_03_870Z-debug-0.log

Expected-behavior

start.vaadin.com generates working apps.

Reproduction

create an app in start.vaadin.com selecting Vaadin 24 pre version and try to run it.

System Info

OS X, Vaadin v24 alpha 7, JDK 17 (Zulu), npm 9.2.0

vaadin-bot commented 1 year ago

Thanks for using Vaadin! We appreciate your help and we’ll take care of this as soon as possible.

Artur- commented 1 year ago

Looks like a problem in npm

flozano commented 1 year ago

just to confirm: same steps when generating the project with vaadin 23 generate a fully working app

Artur- commented 1 year ago

Can you post the package.json from the problematic project and we can see if it reproduces for somebody else. I can download a V24 project and run npm install just fine, also with npm 9.2.0

flozano commented 1 year ago

@Artur- did you generate the project with start.vaadin.com and worked for you?

This is the failing version (vaadin 24): package.txt

This is the working version (vaadin 23): package.txt

and this is a diff: package.json.diff.txt

flozano commented 1 year ago

This is the project generated with start.vaadin.com / vaadin24 failing-vaadin24.zip

This is the same but with vaadin 23 (works): working-vaadin23.zip

Artur- commented 1 year ago

With the project zip I can reproduce it. It is related not only to package.json but also package-lock.json. If you delete package-lock.json and run again it will take quite some time but work

flozano commented 1 year ago

oh, I'll try right now

flozano commented 1 year ago

@Artur- your suggested solution works well, removing the package-lock.json in the generated project and letting npm recalculate it worked well. thanks!

(beware the "faulty" package-lock.json came from the downloaded zip so I guess the problem remains in start.vaadin.com site)

Artur- commented 1 year ago

Created https://github.com/npm/cli/issues/6028

Artur- commented 1 year ago

This was fixed in npm 9.3.0

flozano commented 1 year ago

thanks!