vite-pwa / vite-plugin-pwa

Zero-config PWA for Vite
https://vite-pwa-org.netlify.app/
MIT License
3.08k stars 201 forks source link

examples/vue-router does not seem to work #432

Closed iqre8 closed 5 months ago

iqre8 commented 1 year ago

Expected behaviour: That we could install the dependancies and run the example. Actual behaviour: When doing an npm install, it could not resolve the dependancies. See below for errors Changed in package.json from "vite-plugin-pwa": "workspace:*", to "vite-plugin-pwa": "^0.14.0",

After doing npm run dev -- --host I however still see 'No matching service worker detected' in chrome -> developer tools ->Application -> Manifest image

0 verbose cli /usr/bin/node /usr/bin/npm
1 info using npm@8.11.0
2 info using node@v16.15.1
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:/usr/lib/node_modules/npm/npmrc Completed in 1ms
6 timing config:load:builtin Completed in 1ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:/home/ubuntu/vite-plugin-pwa-main/examples/vue-router/.npmrc Completed in 0ms
10 timing config:load:project Completed in 15ms
11 timing config:load:file:/home/ubuntu/.npmrc Completed in 1ms
12 timing config:load:user Completed in 1ms
13 timing config:load:file:/usr/etc/npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 1ms
16 timing config:load:credentials Completed in 1ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 25ms
19 timing npm:load:configload Completed in 27ms
20 timing npm:load:mkdirpcache Completed in 1ms
21 timing npm:load:mkdirplogs Completed in 1ms
22 verbose title npm install
23 verbose argv "install"
24 timing npm:load:setTitle Completed in 2ms
25 timing config:load:flatten Completed in 4ms
26 timing npm:load:display Completed in 7ms
27 verbose logfile logs-max:10 dir:/home/ubuntu/.npm/_logs
28 verbose logfile /home/ubuntu/.npm/_logs/2022-12-21T13_40_26_427Z-debug-0.log
29 timing npm:load:logFile Completed in 7ms
30 timing npm:load:timers Completed in 0ms
31 timing npm:load:configScope Completed in 0ms
32 timing npm:load Completed in 46ms
33 timing arborist:ctor Completed in 1ms
34 silly logfile start cleaning logs, removing 1 files
35 silly logfile done cleaning log files
36 timing arborist:ctor Completed in 1ms
37 timing idealTree:init Completed in 19ms
38 timing idealTree:userRequests Completed in 0ms
39 silly idealTree buildDeps
40 silly fetch manifest vue@^3.2.45
41 http fetch GET 200 https://registry.npmjs.org/vue 30ms (cache hit)
42 silly fetch manifest vue-router@^4.1.6
43 http fetch GET 200 https://registry.npmjs.org/vue-router 9ms (cache hit)
44 silly fetch manifest @rollup/plugin-replace@^5.0.1
45 http fetch GET 200 https://registry.npmjs.org/@rollup%2fplugin-replace 9ms (cache hit)
46 silly fetch manifest rollup@^1.20.0||^2.0.0||^3.0.0
47 http fetch GET 200 https://registry.npmjs.org/rollup 14ms (cache hit)
48 silly fetch manifest @vitejs/plugin-vue@^4.0.0
49 http fetch GET 200 https://registry.npmjs.org/@vitejs%2fplugin-vue 10ms (cache hit)
50 silly fetch manifest vite@^4.0.0
51 http fetch GET 200 https://registry.npmjs.org/vite 11ms (cache hit)
52 silly fetch manifest @types/node@>= 14
53 http fetch GET 200 https://registry.npmjs.org/@types%2fnode 26ms (cache hit)
54 silly fetch manifest less@*
55 http fetch GET 200 https://registry.npmjs.org/less 7ms (cache hit)
56 silly fetch manifest sass@*
57 http fetch GET 200 https://registry.npmjs.org/sass 8ms (cache hit)
58 silly fetch manifest stylus@*
59 http fetch GET 200 https://registry.npmjs.org/stylus 7ms (cache hit)
60 silly fetch manifest sugarss@*
61 http fetch GET 200 https://registry.npmjs.org/sugarss 5ms (cache hit)
62 silly fetch manifest postcss@^8.3.3
63 http fetch GET 200 https://registry.npmjs.org/postcss 6ms (cache hit)
64 silly fetch manifest terser@^5.4.0
65 http fetch GET 200 https://registry.npmjs.org/terser 6ms (cache hit)
66 silly fetch manifest @vueuse/core@^9.6.0
67 http fetch GET 200 https://registry.npmjs.org/@vueuse%2fcore 11ms (cache hit)
68 silly fetch manifest cross-env@^7.0.3
69 http fetch GET 200 https://registry.npmjs.org/cross-env 7ms (cache hit)
70 silly fetch manifest https-localhost@^4.7.1
71 http fetch GET 200 https://registry.npmjs.org/https-localhost 6ms (cache hit)
72 silly fetch manifest rimraf@^3.0.2
73 http fetch GET 200 https://registry.npmjs.org/rimraf 6ms (cache hit)
74 silly fetch manifest typescript@^4.9.4
75 http fetch GET 200 https://registry.npmjs.org/typescript 29ms (cache hit)
76 timing idealTree Completed in 433ms
77 timing command:install Completed in 452ms
78 verbose stack Error: Unsupported URL Type "workspace:": workspace:*
78 verbose stack     at unsupportedURLType (/usr/lib/node_modules/npm/node_modules/npm-package-arg/lib/npa.js:262:15)
78 verbose stack     at fromURL (/usr/lib/node_modules/npm/node_modules/npm-package-arg/lib/npa.js:322:13)
78 verbose stack     at Function.resolve (/usr/lib/node_modules/npm/node_modules/npm-package-arg/lib/npa.js:80:12)
78 verbose stack     at Arborist.[nodeFromEdge] (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1107:22)
78 verbose stack     at Arborist.[buildDepStep] (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:976:36)
78 verbose stack     at async Arborist.buildIdealTree (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:218:7)
78 verbose stack     at async Promise.all (index 1)
78 verbose stack     at async Arborist.reify (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:153:5)
78 verbose stack     at async Install.exec (/usr/lib/node_modules/npm/lib/commands/install.js:156:5)
78 verbose stack     at async module.exports (/usr/lib/node_modules/npm/lib/cli.js:78:5)
79 verbose cwd /home/ubuntu/vite-plugin-pwa-main/examples/vue-router
80 verbose Linux 5.4.0-135-generic
81 verbose node v16.15.1
82 verbose npm  v8.11.0
83 error code EUNSUPPORTEDPROTOCOL
84 error Unsupported URL Type "workspace:": workspace:*
85 verbose exit 1
86 timing npm Completed in 583ms
87 verbose unfinished npm timer reify 1671630026553
88 verbose unfinished npm timer reify:loadTrees 1671630026567
89 verbose unfinished npm timer idealTree:buildDeps 1671630026588
90 verbose unfinished npm timer idealTree:#root 1671630026589
91 verbose code 1
92 error A complete log of this run can be found in:
92 error     /home/ubuntu/.npm/_logs/2022-12-21T13_40_26_427Z-debug-0.log
userquin commented 1 year ago

@iqre8 read contributing file, we're using pnpm as package manager

userquin commented 1 year ago

Upps, I didn't read full issue...

chawes13 commented 10 months ago

@iqre8 read contributing file, we're using pnpm as package manager

I ran into this with npm v10.1.0 as well. The docs on https://vite-pwa-org.netlify.app/examples/ have conflicting information. It says both,

If you don't have installed PNPM, you must install it globally via npm: npm install -g pnpm

But then further down says,

We use PNPM but should work with any package manager, for example, with YARN: yarn && yarn build

Yarn install gracefully fails on the workspace:* package.json entry, but npm fails. Image 2023-10-23 at 1 03 45 PM

If the requirement to run the examples requires pnpm, then I think it would be helpful to update the language referenced above

userquin commented 10 months ago

If you want to use anther package manager you should update the configuration in your local properly, we use pnpm workspaces.

michaeltoohig commented 10 months ago

Can I raise the vue-router example uses nr in many of the package.json scripts. nr is not in the devDependencies and that is the recommendation from the nr docs https://github.com/darkobits/nr however when I install nr in my test environment the example project still won't start as it is looking for an nr config file which is not present in the example repo given. I'm just thoroughly confused by this I must be doing something wrong, can you shed any light on my questions?

userquin commented 10 months ago

@michaeltoohig nr is a script from ni dependency: https://github.com/vite-pwa/vite-plugin-pwa/blob/main/package.json#L115

EDIT: check the contributing guide, there is a link to previous repo IIRC.