cari

Rumah  >  Soal Jawab  >  teks badan

Pengkompil templat Vue2 rosak?

Saya menyusun kod saya melalui webpack(^5.51.1) dan vue-loader(^17.0.0) dan saya cuba memulakan projek lama tetapi ia memberi saya ralat ini:

[webpack-cli] Failed to load '/var/www/webpack.config.js' config
[webpack-cli] Error: Cannot find module 'vue/compiler-sfc'
Require stack:
- /var/www/node_modules/vue-loader/dist/resolveScript.js
- /var/www/node_modules/vue-loader/dist/select.js
- /var/www/node_modules/vue-loader/dist/index.js
- /var/www/webpack.config.js
- /var/www/node_modules/webpack-cli/lib/webpack-cli.js
- /var/www/node_modules/webpack-cli/lib/bootstrap.js
- /var/www/node_modules/webpack-cli/bin/cli.js
- /var/www/node_modules/webpack/bin/webpack.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (/var/www/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.<anonymous> (/var/www/node_modules/vue-loader/dist/resolveScript.js:5:24)
    at Module._compile (/var/www/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1151:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:999:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/var/www/node_modules/vue-loader/dist/resolveScript.js',
    '/var/www/node_modules/vue-loader/dist/select.js',
    '/var/www/node_modules/vue-loader/dist/index.js',
    '/var/www/webpack.config.js',
    '/var/www/node_modules/webpack-cli/lib/webpack-cli.js',
    '/var/www/node_modules/webpack-cli/lib/bootstrap.js',
    '/var/www/node_modules/webpack-cli/bin/cli.js',
    '/var/www/node_modules/webpack/bin/webpack.js'
  ]
}

Saya benar-benar tidak tahu apa yang berlaku. Saya cuba menambahkan @vue/compiler-sfc pada package.json saya tetapi ia tidak berfungsi. Saya benar-benar tidak mahu beralih kepada Vue3 kerana itu akan memecahkan banyak perkara.

Edit: Lihat package.json:pastebin

P粉731977554P粉731977554275 hari yang lalu425

membalas semua(1)saya akan balas

  • P粉486743671

    P粉4867436712024-02-27 00:23:16

    Nampaknya terdapat beberapa perubahan pecah dalam vue-loader > 15. Ia memberitahu saya untuk memaksa npm kekal pada versi 15. Tidak dijumpai di tempat lain...

    balas
    0
  • Batalbalas