Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG | Unable to start with npm #8

Closed
2 tasks done
peterbe opened this issue Jun 7, 2022 · 3 comments
Closed
2 tasks done

BUG | Unable to start with npm #8

peterbe opened this issue Jun 7, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@peterbe
Copy link

peterbe commented Jun 7, 2022

What happened?

Complete output here:

β–Ά npm x plasmo init
Need to install the following packages:
  plasmo
Ok to proceed? (y) y
🟣 Plasmo v0.38.2
🟠 The browser extension development framework.
🟑 Extension name: top2hem
πŸ”΅ INFO   | Copying template files...
πŸ”΅ INFO   | Installing dependencies...
  plasmo latest                                                   finding Β·
  @trivago/prettier-plugin-sort-imports 3.2.0                     finding Β·
  @types/chrome 0.0.188                                        installing .
  @types/node 17.0.40                                             finding Β·
  @types/react 18.0.12                                            finding Β·
  @types/react-dom 18.0.5                                         finding Β·
  prettier 2.6.2                                                  finding Β·
  typescript 4.7.3                                                finding Β·
  react 18.1.0                                                    finding Β·
  react-dom 18.1.0                                                finding Β·
/usr/local/lib/node_modules/pnpm/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:287
      if (cb) cb.apply(this, arguments)
                 ^

TypeError: cb.apply is not a function
    at /usr/local/lib/node_modules/pnpm/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:287:18
    at /usr/local/lib/node_modules/pnpm/lib/node_modules/graceful-fs/polyfills.js:287:18
    at FSReqCallback.oncomplete (node:fs:199:5)

Node.js v17.1.0
πŸ”΄ ERROR  | pnpm exited with non-zero code: 1
          | Error: pnpm exited with non-zero code: 1
    at ChildProcess.completionListener (/Users/peterbe/.npm/_npx/b3939d9506966e6f/node_modules/@expo/spawn-async/build/spawnAsync.js:43:23)
    at Object.onceWrapper (node:events:510:26)
    at ChildProcess.emit (node:events:390:28)
    at maybeClose (node:internal/child_process:1062:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
    ...
    at spawnAsync (/Users/peterbe/.npm/_npx/b3939d9506966e6f/node_modules/@expo/spawn-async/build/spawnAsync.js:8:21)
    at /Users/peterbe/.npm/_npx/b3939d9506966e6f/node_modules/plasmo/dist/index.js:48:3398
    at Generator.next (<anonymous>)
    at o (/Users/peterbe/.npm/_npx/b3939d9506966e6f/node_modules/plasmo/dist/index.js:2:1593)
πŸ”΄ EXIT   | πŸ‘‹ Good bye and have a great day!

Also probably relevant:

β–Ά node --version
v17.1.0

β–Ά npm --version
8.7.0

Version

Latest

What OS are you seeing the problem on?

MacOSX

What browsers are you seeing the problem on?

No response

Relevant log output

No response

(OPTIONAL) Contact Details

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I checked the current issues for duplicate problems.
@peterbe peterbe added the bug Something isn't working label Jun 7, 2022
@peterbe
Copy link
Author

peterbe commented Jun 7, 2022

Switching to pnpm dlx plasmo init worked.

@ColdSauce
Copy link
Contributor

Thanks for the bug report, @peterbe.

npm x plasmo init works both in our CI environment and locally on my laptop, so I suspect there is some weird cache issue happening here.

It seems to be an issue with the graceful-fs package that was fixed a while ago. We use this package because fs-extra depends on it:

Ξ» ~/plasmo/plasmo/ main pnpm why graceful-fs
Legend: production dependency, optional only, dev only

p1asm0 /Users/coldsauce/plasmo/plasmo

devDependencies:
fs-extra 10.1.0
β”œβ”€β”€ graceful-fs 4.2.10
└─┬ jsonfile 6.1.0
  └── graceful-fs 4.2.10

I suspect the problem is that your cached version of graceful-fs seems to be very old, and that's what's being used by npm x for some reason.

If you run

cat /usr/local/lib/node_modules/pnpm/lib/node_modules/npm/node_modules/graceful-fs/package.json | grep version

What version number does it show?

@ColdSauce
Copy link
Contributor

I'm going to close this issue for now, but please let me know if you think my assessment of the situation is incorrect, or if you have an up-to-date version of the graceful-fs package.

We'll think more about how to detect these npm cache issues on our side, but they might be outside Plasmo's scope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants