antfu-collective / vitesse

🏕 Opinionated Vite + Vue Starter Template
https://vitesse.netlify.app/
MIT License
8.8k stars 931 forks source link

@vueuse/core error after cloning #180

Closed flahol closed 3 years ago

flahol commented 3 years ago

I cloned the rep I start pnpm dev and I get this error :

failed to load config from /home/patrice/Websites/obizoo/obizoo.vue/vite.config.ts
error when starting dev server:
Error: [auto-import] failed to load @vueuse/core, have you installed it?
    at vueuse_core_default (/home/patrice/Websites/obizoo/obizoo.vue/node_modules/.pnpm/unplugin-auto-import@0.1.7_vite@2.5.1/node_modules/unplugin-auto-import/dist/chunk-U6Z5VRX4.js:136:13)
    at /home/patrice/Websites/obizoo/obizoo.vue/node_modules/.pnpm/unplugin-auto-import@0.1.7_vite@2.5.1/node_modules/unplugin-auto-import/dist/chunk-G7WHTJIF.js:32:51
    at Array.forEach (<anonymous>)
    at flattenImportsMap (/home/patrice/Websites/obizoo/obizoo.vue/node_modules/.pnpm/unplugin-auto-import@0.1.7_vite@2.5.1/node_modules/unplugin-auto-import/dist/chunk-G7WHTJIF.js:27:36)
    at resolveOptions (/home/patrice/Websites/obizoo/obizoo.vue/node_modules/.pnpm/unplugin-auto-import@0.1.7_vite@2.5.1/node_modules/unplugin-auto-import/dist/chunk-G7WHTJIF.js:16:19)
    at /home/patrice/Websites/obizoo/obizoo.vue/node_modules/.pnpm/unplugin-auto-import@0.1.7_vite@2.5.1/node_modules/unplugin-auto-import/dist/chunk-G7WHTJIF.js:108:20
    at /home/patrice/Websites/obizoo/obizoo.vue/node_modules/.pnpm/unplugin@0.2.3_vite@2.5.1/node_modules/unplugin/dist/index.cjs:45:23
    at Object.<anonymous> (/home/patrice/Websites/obizoo/obizoo.vue/vite.config.ts:58:30)
    at Module._compile (internal/modules/cjs/loader.js:1251:30)
    at Object.require.extensions.<computed> [as .ts] (/home/patrice/Websites/obizoo/obizoo.vue/node_modules/.pnpm/vite@2.5.1/node_modules/vite/dist/node/chunks/dep-972722fa.js:75935:20)
 ERROR  Command failed with exit code 1.
antfu commented 3 years ago

Which node version are you using?

antfu commented 3 years ago

Please try with unplugin-auto-import v0.2.6

flahol commented 3 years ago

After updating latest versions of every files, still one error node 16.8.0, ubuntu 21.04

/home/patrice/Websites/obizoo/obizoo.vue/vite.config.ts
error when starting dev server:
Error: [auto-import] failed to load @vueuse/core, have you installed it?
    at vueuse_core_default (/home/patrice/Websites/obizoo/obizoo.vue/node_modules/.pnpm/unplugin-auto-import@0.3.3_@vueuse+core@6.0.0+vite@2.5.3/node_modules/unplugin-auto-import/dist/chunk-T5OU4655.js:227:13)
    at /home/patrice/Websites/obizoo/obizoo.vue/node_modules/.pnpm/unplugin-auto-import@0.3.3_@vueuse+core@6.0.0+vite@2.5.3/node_modules/unplugin-auto-import/dist/chunk-5I5CMYBW.js:39:51
    at Array.forEach (<anonymous>)
    at flattenImportsMap (/home/patrice/Websites/obizoo/obizoo.vue/node_modules/.pnpm/unplugin-auto-import@0.3.3_@vueuse+core@6.0.0+vite@2.5.3/node_modules/unplugin-auto-import/dist/chunk-5I5CMYBW.js:34:36)
    at resolveOptions (/home/patrice/Websites/obizoo/obizoo.vue/node_modules/.pnpm/unplugin-auto-import@0.3.3_@vueuse+core@6.0.0+vite@2.5.3/node_modules/unplugin-auto-import/dist/chunk-5I5CMYBW.js:18:19)
    at /home/patrice/Websites/obizoo/obizoo.vue/node_modules/.pnpm/unplugin-auto-import@0.3.3_@vueuse+core@6.0.0+vite@2.5.3/node_modules/unplugin-auto-import/dist/chunk-5I5CMYBW.js:159:20
    at /home/patrice/Websites/obizoo/obizoo.vue/node_modules/.pnpm/unplugin@0.2.7_vite@2.5.3/node_modules/unplugin/dist/index.js:79:23
    at Object.<anonymous> (/home/patrice/Websites/obizoo/obizoo.vue/vite.config.ts:59:30)
    at Module._compile (internal/modules/cjs/loader.js:1251:30)
    at Object.require.extensions.<computed> [as .ts] (/home/patrice/Websites/obizoo/obizoo.vue/node_modules/.pnpm/vite@2.5.3/node_modules/vite/dist/node/chunks/dep-1be34a63.js:77161:20)
 ERROR  Command failed with exit code 1.
antfu commented 3 years ago

Please use Node >= v14

flahol commented 3 years ago

I'm using Node 16.8.0

antfu commented 3 years ago

I can't reproduce on my side, can you share a minimal reproduction?

flahol commented 3 years ago

Here is my package.json

{
  "private": true,
  "scripts": {
    "dev": "vite --port 3333 --open",
    "build": "cross-env NODE_ENV=production vite-ssg build",
    "preview": "vite preview",
    "preview-https": "serve dist"
  },
  "dependencies": {
    "@vueuse/core": "^6.1.0",
    "@vueuse/head": "^0.6.0",
    "nprogress": "^0.2.0",
    "pinia": "^2.0.0-rc.6",
    "prism-theme-vars": "^0.2.2",
    "vue": "^3.2.8",
    "vue-demi": "^0.11.3",
    "vue-i18n": "^9.1.7",
    "vue-router": "^4.0.11"
  },
  "devDependencies": {
    "@antfu/eslint-config": "^0.7.0",
    "@iconify/json": "^1.1.397",
    "@intlify/vite-plugin-vue-i18n": "^2.4.0",
    "@types/markdown-it-link-attributes": "^3.0.1",
    "@types/nprogress": "^0.2.0",
    "@vitejs/plugin-vue": "^1.6.0",
    "@vue/compiler-sfc": "^3.2.8",
    "@vue/server-renderer": "^3.2.8",
    "critters": "^0.0.10",
    "cross-env": "^7.0.3",
    "eslint": "^7.32.0",
    "https-localhost": "^4.6.5",
    "markdown-it-link-attributes": "^3.0.0",
    "markdown-it-prism": "^2.2.0",
    "pnpm": "^6.14.6",
    "typescript": "^4.4.2",
    "unplugin-auto-import": "^0.4.0",
    "unplugin-icons": "^0.7.5",
    "unplugin-vue-components": "^0.14.11",
    "vite": "^2.5.3",
    "vite-plugin-md": "^0.11.0",
    "vite-plugin-pages": "^0.18.0",
    "vite-plugin-pwa": "^0.11.2",
    "vite-plugin-vue-layouts": "^0.4.0",
    "vite-plugin-windicss": "^1.3.0",
    "vite-ssg": "^0.14.7",
    "vue-tsc": "^0.3.0"
  }
}
flahol commented 3 years ago

Updated unplugin-auto-import, same error

failed to load config from /home/patrice/Websites/obizoo/obizoo-app/vite.config.ts
error when starting dev server:
Error: [auto-import] failed to load @vueuse/core, have you installed it?
    at vueuse_core_default (/home/patrice/Websites/obizoo/obizoo-app/node_modules/.pnpm/unplugin-auto-import@0.4.1_@vueuse+core@6.1.0+vite@2.5.3/node_modules/unplugin-auto-import/dist/chunk-T5OU4655.js:227:13)
    at /home/patrice/Websites/obizoo/obizoo-app/node_modules/.pnpm/unplugin-auto-import@0.4.1_@vueuse+core@6.1.0+vite@2.5.3/node_modules/unplugin-auto-import/dist/chunk-3PC4NCNL.js:40:51
    at Array.forEach (<anonymous>)
    at flattenImportsMap (/home/patrice/Websites/obizoo/obizoo-app/node_modules/.pnpm/unplugin-auto-import@0.4.1_@vueuse+core@6.1.0+vite@2.5.3/node_modules/unplugin-auto-import/dist/chunk-3PC4NCNL.js:35:36)
    at resolveOptions (/home/patrice/Websites/obizoo/obizoo-app/node_modules/.pnpm/unplugin-auto-import@0.4.1_@vueuse+core@6.1.0+vite@2.5.3/node_modules/unplugin-auto-import/dist/chunk-3PC4NCNL.js:18:19)
    at /home/patrice/Websites/obizoo/obizoo-app/node_modules/.pnpm/unplugin-auto-import@0.4.1_@vueuse+core@6.1.0+vite@2.5.3/node_modules/unplugin-auto-import/dist/chunk-3PC4NCNL.js:172:20
    at /home/patrice/Websites/obizoo/obizoo-app/node_modules/.pnpm/unplugin@0.2.7_vite@2.5.3/node_modules/unplugin/dist/index.js:79:23
    at Object.<anonymous> (/home/patrice/Websites/obizoo/obizoo-app/vite.config.ts:59:30)
    at Module._compile (internal/modules/cjs/loader.js:1251:30)
    at Object.require.extensions.<computed> [as .ts] (/home/patrice/Websites/obizoo/obizoo-app/node_modules/.pnpm/vite@2.5.3/node_modules/vite/dist/node/chunks/dep-1be34a63.js:77161:20)
 ERROR  Command failed with exit code 1.
flahol commented 3 years ago

I downgraded node 16.8.0 to 14.17.6, same error

flahol commented 3 years ago

Problem solved On Ubuntu 21.04 an old version of node was installed 12.x.x with sudo apt install node. Newest version of node 16.8.0 was installed with nvm. node -v would return v16.8.0 but I guess some files from 12.x.x were still used.

I removed both versions and then re installed node with nvm, no error

mulhoon commented 3 years ago

I also get this issue following the Clone to local instructions

npx degit antfu/vitesse my-vitesse-app
cd my-vitesse-app
pnpm i

then

pnpm dev
> @ dev /Users/mulhoon/Projects/my-vitesse-app
> vite --port 3333 --open

failed to load config from /Users/mulhoon/Projects/my-vitesse-app/vite.config.ts
error when starting dev server:
Error: [auto-import] failed to load @vueuse/core, have you installed it?
    at vueuse_core_default (/Users/mulhoon/Projects/my-vitesse-app/node_modules/.pnpm/unplugin-auto-import@0.2.6_@vueuse+core@6.0.0+vite@2.5.1/node_modules/unplugin-auto-import/dist/chunk-YEXUR5PY.js:217:13)
    at /Users/mulhoon/Projects/my-vitesse-app/node_modules/.pnpm/unplugin-auto-import@0.2.6_@vueuse+core@6.0.0+vite@2.5.1/node_modules/unplugin-auto-import/dist/chunk-E2MKH6WU.js:36:51
    at Array.forEach (<anonymous>)
    at flattenImportsMap (/Users/mulhoon/Projects/my-vitesse-app/node_modules/.pnpm/unplugin-auto-import@0.2.6_@vueuse+core@6.0.0+vite@2.5.1/node_modules/unplugin-auto-import/dist/chunk-E2MKH6WU.js:31:36)
    at resolveOptions (/Users/mulhoon/Projects/my-vitesse-app/node_modules/.pnpm/unplugin-auto-import@0.2.6_@vueuse+core@6.0.0+vite@2.5.1/node_modules/unplugin-auto-import/dist/chunk-E2MKH6WU.js:17:19)
    at /Users/mulhoon/Projects/my-vitesse-app/node_modules/.pnpm/unplugin-auto-import@0.2.6_@vueuse+core@6.0.0+vite@2.5.1/node_modules/unplugin-auto-import/dist/chunk-E2MKH6WU.js:118:20
    at /Users/mulhoon/Projects/my-vitesse-app/node_modules/.pnpm/unplugin@0.2.3_vite@2.5.1/node_modules/unplugin/dist/index.cjs:45:23
    at Object.<anonymous> (/Users/mulhoon/Projects/my-vitesse-app/vite.config.ts:59:30)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.require.extensions.<computed> [as .ts] (/Users/mulhoon/Projects/my-vitesse-app/node_modules/.pnpm/vite@2.5.1/node_modules/vite/dist/node/chunks/dep-972722fa.js:75935:20)
 ERROR  Command failed with exit code 1.

My node version (node -v) is v14.15.4 installed with nvm on Macbook M1. I'm not sure how to find or uninstall any other versions of node that may be installed other than through nvm.

Any help would be appreciated.

Thanks Nic

flahol commented 3 years ago

First you can check how many node versions are installed nvm ls If more than one you can delete one version, example for 4.2.3 nvm uninstall 4.2.3 If it does not work you can check the directories cd ~/.nvm/versions/node and remove an old version rm -Rf v4.2.3

wjr-dev commented 3 years ago

I have same error,I removed all node versions and then re installed node with nvm, no error nvm uninstall your all node versions nvm install 16.8.0, install node 16.8.0 use nvm just can run

antfu commented 3 years ago

Can you try with unplugin-auto-import v0.4.2

mulhoon commented 3 years ago

@antfu I'm afraid it didn't work. I tried with v0.4.4 and v0.4.2

pnpm i

 WARN  vite-ssg@0.14.7 requires a peer of @vueuse/head@^0.5.1 but version 0.6.0 was installed.
Packages: +1 -1
+-
Progress: resolved 428, reused 427, downloaded 1, added 1, done

devDependencies:
- unplugin-auto-import 0.4.4
+ unplugin-auto-import 0.4.2 (0.4.4 is available)
mulhoon@mulhoon my-vitesse-app % pnpm dev

> @ dev /Users/mulhoon/Projects/my-vitesse-app
> vite --port 3333 --open

TypeError: __require.resolve is not a function
    at vueuse_core_default (/Users/mulhoon/Projects/my-vitesse-app/node_modules/.pnpm/unplugin-auto-import@0.4.2_@vueuse+core@6.0.0+vite@2.5.1/node_modules/unplugin-auto-import/dist/chunk-TFKUXVWE.js:222:30)
    at /Users/mulhoon/Projects/my-vitesse-app/node_modules/.pnpm/unplugin-auto-import@0.4.2_@vueuse+core@6.0.0+vite@2.5.1/node_modules/unplugin-auto-import/dist/chunk-7WDCF2GU.js:40:51
    at Array.forEach (<anonymous>)
    at flattenImportsMap (/Users/mulhoon/Projects/my-vitesse-app/node_modules/.pnpm/unplugin-auto-import@0.4.2_@vueuse+core@6.0.0+vite@2.5.1/node_modules/unplugin-auto-import/dist/chunk-7WDCF2GU.js:35:36)
    at resolveOptions (/Users/mulhoon/Projects/my-vitesse-app/node_modules/.pnpm/unplugin-auto-import@0.4.2_@vueuse+core@6.0.0+vite@2.5.1/node_modules/unplugin-auto-import/dist/chunk-7WDCF2GU.js:18:19)
    at /Users/mulhoon/Projects/my-vitesse-app/node_modules/.pnpm/unplugin-auto-import@0.4.2_@vueuse+core@6.0.0+vite@2.5.1/node_modules/unplugin-auto-import/dist/chunk-7WDCF2GU.js:172:20
    at /Users/mulhoon/Projects/my-vitesse-app/node_modules/.pnpm/unplugin@0.2.7_vite@2.5.1/node_modules/unplugin/dist/index.js:79:23
    at Object.<anonymous> (/Users/mulhoon/Projects/my-vitesse-app/vite.config.ts:59:30)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.require.extensions.<computed> [as .ts] (/Users/mulhoon/Projects/my-vitesse-app/node_modules/.pnpm/vite@2.5.1/node_modules/vite/dist/node/chunks/dep-972722fa.js:75935:20)
failed to load config from /Users/mulhoon/Projects/my-vitesse-app/vite.config.ts
error when starting dev server:
Error: [auto-import] failed to load @vueuse/core, have you installed it?
    at vueuse_core_default (/Users/mulhoon/Projects/my-vitesse-app/node_modules/.pnpm/unplugin-auto-import@0.4.2_@vueuse+core@6.0.0+vite@2.5.1/node_modules/unplugin-auto-import/dist/chunk-TFKUXVWE.js:229:13)
    at /Users/mulhoon/Projects/my-vitesse-app/node_modules/.pnpm/unplugin-auto-import@0.4.2_@vueuse+core@6.0.0+vite@2.5.1/node_modules/unplugin-auto-import/dist/chunk-7WDCF2GU.js:40:51
    at Array.forEach (<anonymous>)
    at flattenImportsMap (/Users/mulhoon/Projects/my-vitesse-app/node_modules/.pnpm/unplugin-auto-import@0.4.2_@vueuse+core@6.0.0+vite@2.5.1/node_modules/unplugin-auto-import/dist/chunk-7WDCF2GU.js:35:36)
    at resolveOptions (/Users/mulhoon/Projects/my-vitesse-app/node_modules/.pnpm/unplugin-auto-import@0.4.2_@vueuse+core@6.0.0+vite@2.5.1/node_modules/unplugin-auto-import/dist/chunk-7WDCF2GU.js:18:19)
    at /Users/mulhoon/Projects/my-vitesse-app/node_modules/.pnpm/unplugin-auto-import@0.4.2_@vueuse+core@6.0.0+vite@2.5.1/node_modules/unplugin-auto-import/dist/chunk-7WDCF2GU.js:172:20
    at /Users/mulhoon/Projects/my-vitesse-app/node_modules/.pnpm/unplugin@0.2.7_vite@2.5.1/node_modules/unplugin/dist/index.js:79:23
    at Object.<anonymous> (/Users/mulhoon/Projects/my-vitesse-app/vite.config.ts:59:30)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.require.extensions.<computed> [as .ts] (/Users/mulhoon/Projects/my-vitesse-app/node_modules/.pnpm/vite@2.5.1/node_modules/vite/dist/node/chunks/dep-972722fa.js:75935:20)
 ERROR  Command failed with exit code 1.
antfu commented 3 years ago

@mulhoon yeah, I noticed that as well, how about v0.4.5?

mulhoon commented 3 years ago

@antfu Hmm, different error with v0.4.5. This is the first time I've used pnpm over yarn or npm, so not sure if I've made a rookie mistake.

> @ dev /Users/mulhoon/Projects/my-vitesse-app
> vite --port 3333 --open

error when starting dev server:
Error: [vite-plugin-pages] Vue3's "@vue/compiler-sfc" is required.
    at parseSFC (/Users/mulhoon/Projects/my-vitesse-app/node_modules/.pnpm/vite-plugin-pages@0.18.0_0af502564fb53278e4f42e4690bab263/node_modules/vite-plugin-pages/dist/index.js:68:11)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async getRouteBlock (/Users/mulhoon/Projects/my-vitesse-app/node_modules/.pnpm/vite-plugin-pages@0.18.0_0af502564fb53278e4f42e4690bab263/node_modules/vite-plugin-pages/dist/index.js:149:18)
    at async setPage (/Users/mulhoon/Projects/my-vitesse-app/node_modules/.pnpm/vite-plugin-pages@0.18.0_0af502564fb53278e4f42e4690bab263/node_modules/vite-plugin-pages/dist/index.js:308:59)
    at async resolvePages (/Users/mulhoon/Projects/my-vitesse-app/node_modules/.pnpm/vite-plugin-pages@0.18.0_0af502564fb53278e4f42e4690bab263/node_modules/vite-plugin-pages/dist/index.js:293:7)
    at async Object.configResolved (/Users/mulhoon/Projects/my-vitesse-app/node_modules/.pnpm/vite-plugin-pages@0.18.0_0af502564fb53278e4f42e4690bab263/node_modules/vite-plugin-pages/dist/index.js:519:15)
    at async Promise.all (index 0)
    at async resolveConfig (/Users/mulhoon/Projects/my-vitesse-app/node_modules/.pnpm/vite@2.5.1/node_modules/vite/dist/node/chunks/dep-972722fa.js:75586:5)
    at async createServer (/Users/mulhoon/Projects/my-vitesse-app/node_modules/.pnpm/vite@2.5.1/node_modules/vite/dist/node/chunks/dep-972722fa.js:73957:20)
    at async CAC.<anonymous> (/Users/mulhoon/Projects/my-vitesse-app/node_modules/.pnpm/vite@2.5.1/node_modules/vite/dist/node/cli.js:13963:24)
 ERROR  Command failed with exit code 1.
antfu commented 3 years ago

Have you changed anything in the template?

mulhoon commented 3 years ago

I didn't change anything. Using yarn instead of pnpm works fine.

antfu commented 3 years ago

Maybe upgrade your pnpm to the latest version? /cc @hannoeru any clue on that?

hannoeru commented 3 years ago

No idea, can't reproduce on my side using node 14.15.4 or 16.8.0 with pnpm 6.14.7.

@mulhoon can you try to remove node_modules and reinstall again?

flahol commented 3 years ago

The newest version of node 16.9.0 includes corepack which includes pnpm https://github.com/nodejs/node/releases/tag/v16.9.0

mulhoon commented 3 years ago

I've tried removing node_modules many times and still get the original error. I've also removed pnpm and reinstalled it. I can use yarn for now unless others have the same issue.

hannoeru commented 3 years ago

@mulhoon can you provide some system info by running npx envinfo --system --binaries?

mulhoon commented 3 years ago

npx envinfo --system --binaries

  System:
    OS: macOS 11.5.2
    CPU: (8) x64 Apple M1
    Memory: 145.06 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.15.4 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.5.4 - /usr/local/bin/npm