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

Changes to npm installation methods for npm@5 / Meteor 1.6. #9021

Merged
merged 2 commits into from
Aug 16, 2017

Conversation

abernix
Copy link
Contributor

@abernix abernix commented Aug 15, 2017

This PR submits two changes for the release-1.6 branch (Meteor 1.6) which uses npm@5. Without this fix, on Windows 10 Insider Preview, somewhat cryptic errors were encountered when trying to meteor npm install, such as:

npm ERR! Command failed: C:\Program Files\Git\cmd\git.EXE submodule update -q --init --recursive
npm ERR! C:\Program Files\Git\mingw64/libexec/git-core\git-submodule: line 7: basename: command not found
npm ERR! C:\Program Files\Git\mingw64/libexec/git-core\git-submodule: line 7: sed: command not found
npm ERR! C:\Program Files\Git\mingw64/libexec/git-core\git-submodule: line 19: .: git-sh-setup: file not found

This appears to be fixed if we no longer set the NPM_CONFIG_CACHE variable to our own cache directory. This should be fine given that npm@5 has much more robust, self-healing, concurrency-touting cacache implementation. This should help reduce the amount of disk space by allowing Meteor to use your global npm cache (e.g. ~/.npm, %APPDATA%\npm) instead of its own within the dev bundle.

Additionally, as there are now some more official recommendations on how to launch .cmd and .bat (i.e. Windows) scripts in the docs, this also changes the way we spawn npm install internally (such as when we build npms for packages, or when we install the default skeleton set of npms with meteor create <app> to launch the npm.cmd using cmd.exe as prescribed. Without this change, meteor create <app> was not working for me with 1.6-beta.20.

This was causing problems with `npm@5`, but realistically it may not be
be necessary anymore since `npm@5` has a much smarter global,
self-healing `cacache`.
The `child_process` documentation indicates that .cmd scripts (such as
the `npm.cmd` script for npm) must be started within a shell, such as
cmd.exe.

While it was tempting to switch this to use `child_process`'s `spawn`,
which supports a `shell` option, it would have required us to buffer
our own stdout/stderr output via `data` event handlers.

Ref: https://nodejs.org/api/child_process.html#child_process_spawning_bat_and_cmd_files_on_windows
@abernix abernix requested a review from benjamn August 15, 2017 22:17
@benjamn benjamn added this to the Release 1.6 milestone Aug 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants