plasmo icon indicating copy to clipboard operation
plasmo copied to clipboard

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

Open dougwithseismic opened this issue 1 year ago • 7 comments

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\[email protected]_@[email protected]_@[email protected]__@[email protected][email protected][email protected]._kjttjxptm7iruwazjdsjwzhm6u\node_modules\@expo\spawn-async\package.json' imported from E:\Web Projects\_CLIENTS\WITHSEISMIC\living-in-prague\prague-living-turbo\node_modules\.pnpm\[email protected]_@[email protected]_@[email protected]__@[email protected][email protected][email protected]._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:

  • Plasmo version: 0.88.0
  • Node.js version: v22.2.0
  • npm version: 8.1.0
  • Operating System: Windows 10

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 [email protected].

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\[email protected]_@[email protected]_@[email protected]__@[email protected][email protected][email protected]._kjttjxptm7iruwazjdsjwzhm6u\node_modules\@expo\spawn-async\package.json' imported from E:\Web Projects\_CLIENTS\WITHSEISMIC\living-in-prague\prague-living-turbo\node_modules\.pnpm\[email protected]_@[email protected]_@[email protected]__@[email protected][email protected][email protected]._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

  • [ ] I would like to fix this BUG via a PR

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct
  • [X] I checked the current issues for duplicate problems.

dougwithseismic avatar Jun 20 '24 09:06 dougwithseismic

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 avatar Jun 20 '24 11:06 dougwithseismic

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?

dougwithseismic avatar Jun 20 '24 21:06 dougwithseismic

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" } }

reedjones avatar Jun 20 '24 21:06 reedjones

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.

richardrigutins avatar Jul 28 '24 15:07 richardrigutins

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.

vitorflopes avatar Sep 18 '24 17:09 vitorflopes

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

reedjones avatar Sep 20 '24 22:09 reedjones

The folder name is too long ..... Changing it to a shorter name will fix the problem (mac os does not have this problem, only windows )

zystudios avatar Jan 16 '25 01:01 zystudios