Okay, what is this manure regarding npm?

Seriously, what in the 7 hells am I doing wrong here? Because the error messages of npm are really NOT helpful.

Here’s where npm has bit me in the past:

a) Updating packages to a new version where other packages explicitly stated that they still depend on the older version. This leads to fun times (i.e. everything not working).
b) Not updating packages at all. This lead me to create a bug report with the author’s answer: “That’s been fixed 10 releases ago. What version are you running?” and me realizing that just because I ran npm update 5 minutes ago, this obviously doesn’t mean that it really updated anything. And, no, it doesn’t tell you that there are new versions available. Had to fix this by editing package.json by hand.
c) Or the part where it does update some packages but not all of the packages. Again, broken site.
d) Or the part where it updates packages but does not pull in new dependencies. Because raisins. Can you say: broken site?

Seriously, is it so hard to NOT update packages when you find out about dependency issues? You could simply tell the users, in PLAIN, easy to understand sentences:

New version for ABC is available, the dependencies MNO and XYZ do not have updated versions available yet.
Also, package DCE depends on version x.y.z of ABC
If you want to update anyway, please add the parameter --force

And not this console.log diarrhea where you need some kind of CompSci degree to make sense of what depends on whom.

/endrant

4 Likes

Heh. Word that. On a related note, if anybody has documentation or a guide or some notes on the recommended NPM package development cycle, that would be much appreciated. Are we suppose to do local development of packages from within the node_modules folder? How is that suppose to work? Doesn’t seem like things recompile when files are changed. Would love to read a compare/contrast between /packages and /node_modules.

Working with local npm packages works by just placing it in the node_modules folder and adding it to your packages.json, however, I still prefer to use the old packages folder when possible, since there’s no way to get the client/server separation for now on a npm package

1 Like

For recompiling node packages, I did this:

"scripts": {
    "transpile": "babel --optional runtime src/ --out-dir lib/ --watch"
  },
  1. Add the above to the package.json in the package
  2. Open another console then run the following:
  3. cd path/to/package
  4. npm run transpile

(Based on the structure found here)


Tis a shame, there seems to be so much manual work involved with dependencies… the CLI is a real PITA to use sometimes though usually it should tell you when a (peer) dependency is not met.

2 Likes