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

Fix errors and slowness during grunt-sass install process #1246

Merged

Conversation

nylen
Copy link
Contributor

@nylen nylen commented Aug 10, 2017

Fixes #1212 and in the process significantly improves the runtime and performance of vagrant up (a fresh install now runs about 10-15 minutes faster for me).

Removing the &> /dev/null from npm install grunt-sass reveals a pretty nasty issue. It starts like this:

==> default: > [email protected] install /usr/lib/node_modules/grunt-sass/node_modules/node-sass
==> default: > node scripts/install.js
==> default: Unable to save binary /usr/lib/node_modules/grunt-sass/node_modules/node-sass/vendor/l$
nux-x64-48 : { Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/grunt-sass/node_modul$
s/node-sass/vendor'
==> default:     at Error (native)
==> default:     at Object.fs.mkdirSync (fs.js:923:18)
==> default:     at sync (/usr/lib/node_modules/grunt-sass/node_modules/mkdirp/index.js:71:13)
==> default:     at Function.sync (/usr/lib/node_modules/grunt-sass/node_modules/mkdirp/index.js:77$
24)
==> default:     at checkAndDownloadBinary (/usr/lib/node_modules/grunt-sass/node_modules/node-sass$
scripts/install.js:111:11)
==> default:     at Object.<anonymous> (/usr/lib/node_modules/grunt-sass/node_modules/node-sass/scr$
pts/install.js:154:1)
==> default:     at Module._compile (module.js:570:32)
==> default:     at Object.Module._extensions..js (module.js:579:10)
==> default:     at Module.load (module.js:487:32)
==> default:     at tryModuleLoad (module.js:446:12)
==> default:   errno: -13,
==> default:   code: 'EACCES',
==> default:   syscall: 'mkdir',
==> default:   path: '/usr/lib/node_modules/grunt-sass/node_modules/node-sass/vendor' }

then, node-gyp kicks in with its own errors:

==> default: ensuring nodedir is created
==> default:  /usr/lib/node_modules/grunt-sass/node_modules/node-sass/.node-gyp/6.11.2
==> default: gyp
==> default:  
==> default: WARN EACCES user "root" does not have permission to access the dev dir "/usr/lib/node_m
odules/grunt-sass/node_modules/node-sass/.node-gyp/6.11.2"
==> default: gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/
grunt-sass/node_modules/node-sass/.node-gyp"

This same error message repeats, quickly reaching millions of log lines, until node-gyp runs out of memory:

==> default: FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
==> default:  1: node::Abort() [node-gyp]
==> default:  2: 0x10aaf3c [node-gyp]
==> default:  3: v8::Utils::ReportApiFailure(char const*, char const*) [node-gyp]
==> default:  4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [node-gyp]
==> default:  5: v8::internal::Factory::NewUninitializedFixedArray(int) [node-gyp]
==> default:  6: 0xc4d7cc [node-gyp]
==> default:  7: 0xc4d9f6 [node-gyp]
==> default:  8: 0xc4dc7b [node-gyp]
==> default:  9: v8::internal::JSArray
==> default: ::SetLength(v8::internal::Handle<v8::internal::JSArray>, unsigned int) [node-gyp]
==> default: 10: v8::internal::ArrayConstructInitializeElements(v8::internal::Handle<v8::internal::J
SArray>, v8::internal::Arguments*) [node-gyp]
==> default: 11: 0xe6e3e3 [node-gyp]
==> default: 12: v8::internal::Runtime_ArrayConstructor(int, v8::internal::Object**, v8::internal::I
solate*) [node-gyp]

Then the installation continues. Currently, all of this is hidden from the user, but towards the end of this node-gyp process, it's not possible to vagrant ssh into the VM because free memory is so low.

The fix here is not particularly elegant, but it's the only thing I've found that works, and I think the current state of things is much worse. See npm/npm#3849 (comment) and npm/npm#601 for some background.

Copy link
Contributor

@LoreleiAurora LoreleiAurora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LoreleiAurora
Copy link
Contributor

Fixes #1212

@nylen
Copy link
Contributor Author

nylen commented Aug 10, 2017

I'm not sure how the submodule got included. Removed in cd9aca4.

@LoreleiAurora LoreleiAurora merged commit f4ef43a into Varying-Vagrant-Vagrants:develop Aug 10, 2017
@nylen nylen deleted the fix/grunt-sass-install branch August 10, 2017 18:48
@jeremyfelt jeremyfelt added this to the 2.0.1 milestone Sep 22, 2017
@jeremyfelt jeremyfelt modified the milestones: 2.0.1, 2.1 Nov 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VVV installer halts if grunt is nor installed
4 participants