18F / web-design-standards-drupal

A Drupal base theme that uses the U.S. Web Design System. (ARCHIVED)
Other
46 stars 12 forks source link

Beware of npm and Drupal/Drush .info gotcha #59

Open patrickcate opened 8 years ago

patrickcate commented 8 years ago

Just wanted to point out an issue with Drupal 7/Drush and npm modules that was a major frustration debugging when I encountered it years ago. This has apparently been fixed in a version 7.4x release of Drupal 7, but appears to still be an issue with Drupal 8 in some cases. I also bring it up because I know even though they should, not all Drupal installs are kept updated to their latest releases.

Problem: Many npm modules have a .info file, which is the file extension Drupal uses for it's theme and module info files as well. This can sometimes raise a Segmentation fault: 11 error when Drupal/Drush tries to read them (particularly when clearing caches).

There are a couple ways most people work around this issue:

  1. Run a postinstall npm script which removes .info files from npm modules.
  2. Install gulp and npm modules in a hidden directory inside the theme folder, which apparently also hides it from Drupal/Drush.

I've personally always done option 2 by putting my gulp and npm modules in a .npm folder inside the theme folder.

Here are some more links about the issue:

fureigh commented 8 years ago

Thanks for the rundown, @patrickcate!

Option 2 sounds like the way to go, or a root-level node_modules folder. Either way, the next steps here would be to update the .gitignore file and installation instructions.

The Web Design Standards are now available as an npm module — is there a way to use that without interfering with the ability to install this theme with one click?

patrickcate commented 8 years ago

The Web Design Standards are now available as an npm module — is there a way to use that without interfering with the ability to install this theme with one click?

Do you mean downloading the module directly from npm when installing the theme? If so, then I don't think that's possible. Or at least not reliably since you'd have to make sure nodejs and npm were already installed.