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

Allow cnpm to be used instead of npm on Windows #515

Closed
TooBug opened this issue Oct 28, 2016 · 4 comments
Closed

Allow cnpm to be used instead of npm on Windows #515

TooBug opened this issue Oct 28, 2016 · 4 comments
Labels
enhancement Feature request

Comments

@TooBug
Copy link

TooBug commented Oct 28, 2016

cnpm is a replacement tool of npm which optimized the install speed. BTW, it uses a Chinese mirror by default.

The structure of node_modules is quite different when modules are installed with cnpm. (It uses some soft links.)

The installation of cnpm is:

npm install -g cnpm

When package apps, electron-packager hangs. The log stopped by this:

electron-packager Ignored paths based on the out param: +3ms [ '/Users/TooBug/app-darwin-ia32',
  '/Users/TooBug/app-darwin-x64',
  '/Users/TooBug/app-darwin-armv7l',
  '/Users/TooBug/app-linux-ia32',
  '/Users/TooBug/app-linux-x64',
  '/Users/TooBug/app-linux-armv7l',
  '/Users/TooBug/app-mas-ia32',
  '/Users/TooBug/app-mas-x64',
  '/Users/TooBug/app-mas-armv7l',
  '/Users/TooBug/app-win32-ia32',
  '/Users/TooBug/app-win32-x64',
  '/Users/TooBug/app-win32-armv7l' ]

And the template folder of app is keeping increase, never stops.

I guess the problem occurs on the npm prune step.

related issue: cnpm/npminstall#155

@malept malept added the needs info Issue reporter needs to provide more information for maintainers to take action label Oct 28, 2016
@malept
Copy link
Member

malept commented Oct 28, 2016

Does cnpm prune --production exist? If so, if you modify Electron Packager to use that command instead of npm prune --production, does it still hang?

@TooBug
Copy link
Author

TooBug commented Oct 30, 2016

Yes, cnpm do has the same prune command. How can I force electron-packager to use that command?

@malept malept added enhancement Feature request and removed needs info Issue reporter needs to provide more information for maintainers to take action labels Oct 30, 2016
@malept malept changed the title hangs when using cnpm Allow cnpm to be used instead of npm Oct 30, 2016
@malept malept added the help wanted Needs a contributor from the community label Oct 30, 2016
@malept
Copy link
Member

malept commented Oct 30, 2016

Electron Packager needs to be changed to be able to specify a custom command as the package manager, in order to run the "prune devDependencies" command. (And also an npm install command in the testsuite.)

It should be called packageManager in the API, and --package-manager in the CLI. The default value should be npm. It should fail with a nice error message if the specified package manager either does not exist or is not an executable file.

I am happy to review pull requests that implement this (and, obviously, follow the contributing guidelines).

@malept
Copy link
Member

malept commented Apr 27, 2017

I am having a really difficult time getting cnpm to be called correctly on Windows, for some reason. This is the error I keep getting from both child_process.exec and spawn-rx.spawnPromise, despite running npm install -g cnpm and verifying that it creates a cnpm.cmd file:

Error: The filename, directory name, or volume label syntax is incorrect.

Since Windows is not my area of expertise, I'm inclined to only implement cnpm support for Linux/macOS and wait for someone to file a PR to get this working correctly on Windows. It will raise an error if cnpm is selected on Windows in the meantime.

@malept malept changed the title Allow cnpm to be used instead of npm Allow cnpm to be used instead of npm on Windows May 1, 2017
@malept malept added help wanted Needs a contributor from the community and removed has-pull-request labels May 1, 2017
@malept malept removed the help wanted Needs a contributor from the community label Jan 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request
Projects
None yet
Development

No branches or pull requests

2 participants