Skip to content

Instantly share code, notes, and snippets.

@polotek
Last active June 14, 2016 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save polotek/90b27752e5c3b039d5c5 to your computer and use it in GitHub Desktop.
Save polotek/90b27752e5c3b039d5c5 to your computer and use it in GitHub Desktop.
What's wrong with the npm workflow?

Sara Chipps started this awesome thread about bundler vs. npm. You should check it out cause it's highly entertaining. https://twitter.com/SaraJChipps/status/484727602049859584

But I do want to get more info on the workflow problems people experience with npm. It has always been the simplest thing to me. But I'm also fully aware that perceptions are relative. Most ruby folks are totally fine with bundler even though it gives me constant headaches. But the bundler issues are well documented. This seems to be less true for npm. I want to gather some info about people's experiences. I promise I'll try to refrain from the canned "you're doing it wrong" response.

Also, we've already established that npm is network hungry and could do a better job of maintaining an offline cache. https://twitter.com/ag_dubs/status/484733343108706305 Nobody's arguing that. But I'm less concerned about feature requests here. I'm interested in where npm breaks for you.

Here's Ryan Florence. https://twitter.com/ryanflorence/status/484730296156176385

`rm -rf node_modules && npm cache clean && npm install && npm dedupe` feels almost as reassuring as just `bundle install`

I want to hear about the step before this where something's wrong and a simple npm install doesn't fix it. Messing around with the cache suggests there's something very strange in people's workflows. And messing around with dedupe suggests that the dependency tree that people are trying to achieve is very different from mine. Trashing your whole node_modules folder shouldn't be required. But it's usually an easier step than trying to debug whatever weird state you got yourself into. I believe this is because npm installs don't usually fail and you can just refresh your whole dep tree fairly easily (network permitting).

But these are just my own perceptions. So lets hear it. Why do you hate npm?

@judax
Copy link

judax commented Jun 14, 2016

I am new to NPM but I coming from other development environments I might be missing something as I do not like some of the workflow have-tos. The simplest example is:

  • I want to work with modules, actually creating most of my functionalities in modules.
  • Some modules depend on other modules. Of course, this is done using devDependencies or dependencies in the package.json.

The biggest hurdle I am facing is:

  • Even though there is the option to reference local modules using the file: mechanism, there is no way (or I haven't been able to find) to use environment variables that would be very helpful for sharing code among different developers that just define their OUR_FRAMEWORK_PATH kind of variable to point to where those modules are.
  • Having to remove and re-install modules when they change is a mess. And npm link does not help much either as it is also a mess both in linux based systems (having to change the prefix or work as root? WTF).
    Then again, it might be my inexperience with the platform but I think not being able to easily share modules with other developers without having to do anything (without using a registry or publishing them) and not having an easy way to work with an evolving/under development module is quite surprising/frustrating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment