electron/forge

yarn error, but I'm not using yarn

KernelDeimos opened this issue · 3 comments

Pre-flight checklist

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project uses.
  • I have searched the issue tracker for a bug that matches the one I want to file, without success.

Electron Forge version

7.4.0

Electron version

31.2.1

Operating system

Archlinux

Last known working Electron Forge version

No response

Expected behavior

Ran npx electron-forge import. I shouldn't get any error.

Actual behavior

✔ Checking your system
✔ Locating importable project
❯ Processing configuration and dependencies
  ✖ Installing dependencies
    › Failed to install modules: ["electron-squirrel-startup"]
      With output: Command failed with a non-zero return code (1):
      yarn add electron-squirrel-startup
      yarn add v1.22.22
      info No lockfile found.
      info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
      warning package-lock.json found. Your project contains lock files generated by tools other than
      Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused
      by unsynchronized lock files. To clear this warning, remove package-lock.json.
      error Workspaces can only be enabled in private projects.
      warning package-lock.json found. Your project contains lock files generated by tools other than
      Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused
      by unsynchronized lock files. To clear this warning, remove package-lock.json.
      error Workspaces can only be enabled in private projects.
  ◼ Copying base template Forge configuration
  ◼ Fixing .gitignore
◼ Finalizing import

An unhandled rejection has occurred inside Forge:
Error: Failed to install modules: ["electron-squirrel-startup"]

With output: Command failed with a non-zero return code (1):
yarn add electron-squirrel-startup
yarn add v1.22.22
info No lockfile found.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
error Workspaces can only be enabled in private projects.
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
error Workspaces can only be enabled in private projects.
at exports.default (/home/edube/rgroups/hackathon/electron-terminal/node_modules/@electron-forge/core/dist/util/install-dependencies.js:52:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async _Task.task [as taskFn] (/home/edube/rgroups/hackathon/electron-terminal/node_modules/@electron-forge/core/dist/api/import.js:169:29)
    at async _Task.run (/home/edube/rgroups/hackathon/electron-terminal/node_modules/listr2/dist/index.cjs:2063:11)

Steps to reproduce

  • built an electron app using only npm, never touching yarn
  • tried to run electron-forge in the package

Additional information

It may be worth noting I have my electron app in a workspace, though as far as I can tell this should work fine.

I believe this might be similar to #3164 which we haven't fixed yet. Does passing NODE_INSTALLER=npm as an environment variable when running the command for you?

I believe this might be similar to #3164 which we haven't fixed yet. Does passing NODE_INSTALLER=npm as an environment variable when running the command for you?

That worked, thanks! I'll close this since the issue you referenced is a duplicate.

Both yarn and npm don't work, what should I do? Thanks for your help.