saberland / saber

()==[:::::::::::::> Build static sites in Vue.js, without the hassle
https://saber.egoist.dev
MIT License
2.15k stars 112 forks source link

ERR_PACKAGE_PATH_NOT_EXPORTED #745

Open sharperDev2112 opened 1 year ago

sharperDev2112 commented 1 year ago

Trying to install Saber fresh by following this page: https://saber.egoist.dev/docs/installation.html#prerequisites

Bug report

Steps to reproduce

By following the "Using the Generator" section on your installation page to install, I get errors. I tried this on both a Windows 10 machine and a Mac Pro with Ventura 13.4. Everything during the install runs fine. Then I issue the npm run dev command and I get the following:

npm run dev

dev saber

[info] Using config file: saber-config.yml [info] Using theme: minima [info] Using 2 plugins from config file [error] Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package' is not defined by "exports" in /Users/billuser/Projects/TestProjects/testSSR/my-site/node_modules/vue/package.json at new NodeError (node:internal/errors:371:5) at throwExportsNotFound (node:internal/modules/esm/resolve:453:9) at packageExportsResolve (node:internal/modules/esm/resolve:731:3) at resolveExports (node:internal/modules/cjs/loader:482:36) at Function.Module._findPath (node:internal/modules/cjs/loader:522:31) at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27) at Function.resolve (node:internal/modules/cjs/helpers:108:19) at module.exports (/Users/billuser/Projects/TestProjects/testSSR/my-site/node_modules/saber/lib/webpack/webpack.config.js:44:26) at Saber.getWebpackConfig (/Users/billuser/Projects/TestProjects/testSSR/my-site/node_modules/saber/lib/index.js:288:54) at VueRenderer.getRequestHandler (/Users/billuser/Projects/TestProjects/testSSR/my-site/node_modules/saber/vue-renderer/lib/index.js:391:35)

Using node version 16.14.2, npm version 8.5.0

This is from my Mac. Windows gets the same error.

What is expected?

I expect it to work without the hassle of these errors.

What is actually happening?

This software appears not to work at all and introduces a bunch of high vulnerabilities

Other relevant information

imyelo commented 1 year ago

For anyone come with this issue, locking the vue version to 2.6.x (legacy) will bypass the exception.

package.json with yarn:

{
  // ...
  "resolutions": {
    "vue-server-renderer": "2.6.14",
    "vue-template-compiler": "2.6.14",
    "vue": "2.6.14"
  }
}

package.json with npm >= 8:

{
  // ...
  "overrides": {
    "vue-server-renderer": "2.6.14",
    "vue-template-compiler": "2.6.14",
    "vue": "2.6.14"
  }
}

Or, for saber, completing the filename suffix on this line will fix this issue:

  const ownModulesDir = path.join(
-    path.dirname(require.resolve('vue/package')),
+    path.dirname(require.resolve('vue/package.json')),
    '..'