PlasmoHQ / plasmo

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

[BUG] Fresh Install Blocker - Error: Cannot find package '@expo/spawn-async' when running pnpm dev #1005

Open dougwithseismic opened 3 months ago

dougwithseismic commented 3 months ago

What happened?

Update: Seems to be an issue creating a new plasmo app inside a turbo repo. I've tried with pnpm and npm workspaces and all produce the same error on fresh installs.

Description: I encountered an error when trying to run pnpm dev for a newly created Plasmo extension. The error indicates that the package @expo/spawn-async cannot be found. This issue seems to be related to the Plasmo dependencies.

Steps to Reproduce:

  1. Run pnpm create plasmo to create a new Plasmo extension project. (I've also tried pnpm dlx ...'
  2. Navigate to the project directory.
  3. Run pnpm dev.

Expected Behavior: The development server should start without any errors.

Actual Behavior: The following error is displayed:

Error: Cannot find package 'E:\Web Projects\_CLIENTS\WITHSEISMIC\living-in-prague\prague-living-turbo\node_modules\.pnpm\plasmo@0.88.0_@swc+core@1.5.29_@swc+helpers@0.5.5__@swc+helpers@0.5.5_ejs@3.1.10_lodash@4.17._kjttjxptm7iruwazjdsjwzhm6u\node_modules\@expo\spawn-async\package.json' imported from E:\Web Projects\_CLIENTS\WITHSEISMIC\living-in-prague\prague-living-turbo\node_modules\.pnpm\plasmo@0.88.0_@swc+core@1.5.29_@swc+helpers@0.5.5__@swc+helpers@0.5.5_ejs@3.1.10_lodash@4.17._kjttjxptm7iruwazjdsjwzhm6u\node_modules\plasmo\dist\index.js
Did you mean to import "@expo/spawn-async/build/spawnAsync.js"?
    at legacyMainResolve (node:internal/modules/esm/resolve:210:26)
    at packageResolve (node:internal/modules/esm/resolve:828:14)
    at moduleResolve (node:internal/modules/esm/resolve:914:18)
    at defaultResolve (node:internal/modules/esm/resolve:1119:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:542:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:511:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:241:38)
    at ModuleJob._link (node:internal/modules/esm/module_job:126:49) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Environment:

Additional Information: I have tried the following troubleshooting steps without success:

  1. Verified Node.js version compatibility (tried Node.js v18).
  2. Deleted node_modules and pnpm-lock.yaml, then reinstalled dependencies.
  3. Reinstalled Plasmo using pnpm add plasmo@0.88.0.

Please let me know if you need any additional information or if there are any other steps I can take to resolve this issue.

Version

Latest

What OS are you seeing the problem on?

Windows

What browsers are you seeing the problem on?

No response

Relevant log output

Error: Cannot find package 'E:\Web Projects\_CLIENTS\WITHSEISMIC\living-in-prague\prague-living-turbo\node_modules\.pnpm\plasmo@0.88.0_@swc+core@1.5.29_@swc+helpers@0.5.5__@swc+helpers@0.5.5_ejs@3.1.10_lodash@4.17._kjttjxptm7iruwazjdsjwzhm6u\node_modules\@expo\spawn-async\package.json' imported from E:\Web Projects\_CLIENTS\WITHSEISMIC\living-in-prague\prague-living-turbo\node_modules\.pnpm\plasmo@0.88.0_@swc+core@1.5.29_@swc+helpers@0.5.5__@swc+helpers@0.5.5_ejs@3.1.10_lodash@4.17._kjttjxptm7iruwazjdsjwzhm6u\node_modules\plasmo\dist\index.js
Did you mean to import "@expo/spawn-async/build/spawnAsync.js"?
    at legacyMainResolve (node:internal/modules/esm/resolve:210:26)
    at packageResolve (node:internal/modules/esm/resolve:828:14)
    at moduleResolve (node:internal/modules/esm/resolve:914:18)
    at defaultResolve (node:internal/modules/esm/resolve:1119:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:542:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:511:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:241:38)
    at ModuleJob._link (node:internal/modules/esm/module_job:126:49) {
  code: 'ERR_MODULE_NOT_FOUND'
}

(OPTIONAL) Contribution

Code of Conduct

dougwithseismic commented 3 months ago

Update: Seems to be an issue creating a new plasmo app inside a turbo repo. I've tried with pnpm and npm workspaces and all produce the same error on fresh installs.

dougwithseismic commented 3 months ago

I think I managed to solve this by updating to the latest pnpm v9.4.0 and running pnpm create plasmo. If anyone else is stuck here, can you give it a go?

reedjones commented 3 months ago

I think I managed to solve this by updating to the latest pnpm v9.4.0 and running pnpm create plasmo. If anyone else is stuck here, can you give it a go?

for me what worked was solution here: https://github.com/vercel/next.js/issues/48593#issuecomment-1681930868

"pnpm": { "overrides": { "@swc/helpers@~0.4": "0.4.36" } }

richardrigutins commented 2 months ago

I've encountered the same error on Windows with pnpm v9.6.0 (plasmo v0.88.0).

What worked for me was creating the application in a folder with a shorter file path. For instance, if I create the project inside C:\folderwithreallyreallyreallylongname\chrome-plasmo-extension-tests I get the error, while C:\folderwithlongname\chrome-plasmo-extension-tests works correctly.

vitorflopes commented 2 weeks ago

Encontrei o mesmo erro no Windows com o pnpm v9.6.0 (plasmo v0.88.0).

O que funcionou para mim foi criar o aplicativo em uma pasta com um caminho de arquivo mais curto. Por exemplo, se eu criar o projeto dentro, C:\folderwithreallyreallyreallylongname\chrome-plasmo-extension-testsrecebo o erro, enquanto C:\folderwithlongname\chrome-plasmo-extension-testsfunciona corretamente.

Thanks! That worked for me.

reedjones commented 1 week ago

I've encountered the same error on Windows with pnpm v9.6.0 (plasmo v0.88.0).

What worked for me was creating the application in a folder with a shorter file path. For instance, if I create the project inside C:\folderwithreallyreallyreallylongname\chrome-plasmo-extension-tests I get the error, while C:\folderwithlongname\chrome-plasmo-extension-tests works correctly.

same here