PlasmoHQ / plasmo

🧩 The Browser Extension Framework
https://www.plasmo.com
MIT License
10.31k stars 358 forks source link

[BUG] Cannot install packages on fresh install #983

Closed allister-grange closed 4 months ago

allister-grange commented 4 months ago

What happened?

When running pnpm install plasmo, I am experiencing an error, preventing using the library

node version: v18.20.3 pnpm version: 9.1.1 running on macOS 14.5

Please let me know if you need any more info!

Version

Latest

What OS are you seeing the problem on?

MacOSX

What browsers are you seeing the problem on?

No response

Relevant log output

 ERR_PNPM_WORKSPACE_PKG_NOT_FOUND  In : "@swc/types@workspace:^" is in the dependencies but no package named "@swc/types" is present in the workspace

This error happened while installing the dependencies of plasmo@0.86.3
 at @plasmohq/parcel-config@0.40.8
 at @parcel/config-default@2.9.3
 at @parcel/optimizer-swc@2.9.3
 at @swc/core@1.5.11

Packages found in the workspace:
Progress: resolved 469, reused 424, downloaded 0, added 0

(OPTIONAL) Contribution

Code of Conduct

allister-grange commented 4 months ago

Also tried yarn and npm, having the same symptoms, some error with the @swc/types package.

yarn asks you to choose an option for the version, but still fails in the end

[1/4] 🔍  Resolving packages...
Couldn't find any versions for "@swc/types" that matches "workspace:^"
? Please choose a version of "@swc/types" from this list: (Use arrow keys)
❯ 0.1.7
  0.1.6
  0.1.5
  0.1.4
  0.1.3
  0.1.2
  0.1.1
warning plasmo > @plasmohq/parcel-config > @parcel/config-default > @parcel/optimizer-htmlnano > svgo > stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility

After choosing, I get this error:

Error: Cannot find module '.../node_modules/@parcel/optimizer-swc/node_modules/@swc/core/postinstall.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)
    at Module._load (node:internal/modules/cjs/loader:981:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)
    at node:internal/main/run_main_module:28:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
cckn commented 4 months ago

This issue occurs with @swc/core version 1.5.11. To resolve this issue:

  1. Install @swc/core version 1.5.7:

    npm install @swc/core@1.5.7
    # or
    yarn add @swc/core@1.5.7
    # or 
    pnpm i @swc/core@1.5.7
  2. If @swc/core is already installed, fix it to version 1.5.7. Remove any caret (^) if present.

    "dependencies": {
    "@swc/core": "1.5.7"
    }

    For more details, refer to the https://github.com/swc-project/swc/issues/8988

allister-grange commented 4 months ago

Thanks @cckn, your fix resolved the issue

MarMomento commented 2 months ago

May I ask how you solved it ? @allister-grange

allister-grange commented 2 months ago

@MarMomento I followed exactly what was said here above

This issue occurs with @swc/core version 1.5.11. To resolve this issue:

  1. Install @swc/core version 1.5.7:
npm install @swc/core@1.5.7
# or
yarn add @swc/core@1.5.7
# or 
pnpm i @swc/core@1.5.7
  1. If @swc/core is already installed, fix it to version 1.5.7. Remove any caret (^) if present.
"dependencies": {
  "@swc/core": "1.5.7"
}

For more details, refer to the swc-project/swc#8988

MarMomento commented 2 months ago

This package is in plasmo's dependencies, installing @swc/core@1.5.7 directly in the project doesn't work.

I solved it by downgrading plasmo directly to v0.80