Why npm installs my github repo multiple times and does not do it only once at the top of the tree? - npm

I have a couple of private github repos, and a simplified dependency tree looks something like this.
A
+-B
| +-D
| +-lodash
|
+-C
| +-D
| +-lodash
|
+-D
+-lodash
My private github repo D is installed by npm as many times as it is used and lodash is installed only once in the top of the tree.
It is the same version of D and same version of lodash in every package.
So why D is treated differently?
Is there a way to make npm treat D the same way it treats lodash?

As Vasil Dininski mentioned, this is a npm bug.
For now a possible workaround is to use force-dedupe-git-modules

Related

changing vue version inside a project

Hi I would like to change a projects version of Vue using npm.
I tried :
npm install vue#latest --save
But when I tried :
npm v vue
I got the following :
vue#2.6.14 | MIT | deps: none | versions: 362
Reactive, component-oriented view layer for modern web interfaces.
https://github.com/vuejs/vue#readme
keywords: vue
dist
.tarball: https://registry.npmjs.org/vue/-/vue-2.6.14.tgz
.shasum: e51aa5250250d569a3fbad3a8a5a687d6036e235
.integrity: sha512-x2284lgYvjOMj3Za7kqzRcUSxBboHqtgRE2zlos1qWaOye5yUmHn42LB1250NJBLRwEcdrB0JRwyPTEPhfQjiQ==
.unpackedSize: 3.0 MB
maintainers:
- posva <posva13#gmail.com>
- yyx990803 <yyx990803#gmail.com>
dist-tags:
beta: 3.2.0-beta.8
csp: 1.0.28-csp
latest: 2.6.14
next: 3.2.23
published 5 months ago by posva <posva13#gmail.com>
Indicating that I still was on Vue 2.6.14.
Does anyone know how to solve this problem.
Well if you check the #latest tag on the versions tab on npm the latest version is really 2.6.14.
To use a Vue 3, you need to use a #next tag instead. But that version is not 100% compatible with 2.x so please check the migration guide before doing so (also lot of tooling is not compatible as well and because JS projects usually involve "a lot" of tooling, migration might be not that simple)

How can I display my index.html using parcel?

I would like to display a project I am working on with parcel by typing parcel index.html
parcel charges then display this error message :
29 | "#parcel/transformer-sass": "^2.0.0-beta.2",
30 | "#parcel/transformer-vue": "^2.0.0-beta.2",
| ^^^^^^^^^^^^^^^^^^^^^^^^^ Found this conflicting local requirement.
31 | "#vue/component-compiler-utils": "^3.2.0",
32 | "sass": "^1.26.10",
Thanks for your help!
There are a variety of things that can cause this error, and it's impossible to say exactly what you need to do what without a more specific repro.
However, a little background information about where this error comes from could give you some pointers about where to look / what to try.
Parcel has a feature that will automatically install the dependencies that it needs using npm, yarn or pnpm. For example, suppose you add a .sass file to your project, but have not yet installed #parcel/transformer-sass - parcel tries to detect this and install it automatically. When it works, it's pretty magical, but when it goes wrong, you'll see errors like this.
Two things you can do to possibly fix or work around this error:
Make sure the versions of all parcel-related packages you have installed are aligned. (I see, for example, that you have lots of 2.0.0-beta.2 packages - now that 2.0.0 is released, upgrade to that (or whatever the current version of parcel is in the future).
As a last resort, try disabling auto-install by setting --no-autoinstall cli flag (see docs). You might still get other errors if there are plugins that are required that are not yet installed, but they might be more specific.

How to add module to environment module? So I can load it using module load

When I run module avail, I got:
--------------------------------- /usr/share/modules/modulefiles ---------------------------------
dot module-git module-info modules null use.own
--------------------------------- /usr/share/modules/modulefiles ---------------------------------
dot module-git module-info modules null use.own
And I notice people uses module to load gcc5 cuda10.0 by module load gcc5 cuda10.0 . Like this person did in:
Slurm sbatch for a PyTorch script draining node; gres/gpu: count changed for node node002 from 0 to 1
How do I add things like gcc5 and cuda10.0 to my modules?
You need to craft these modulefiles by hand if you manually install these specific software or the specific version of these software.
If you use a package manager like Spack or EasyBuild to build the software, those tools can also generate the corresponding modulefiles to use the software they built and install.

Multiple versions of the same package using npmjs

Anyone knows a trick to install multiple versions of the same package through npmjs ? I know it's not possible to use the same package-name in package.json but it gives you an idea of what I try to achieve:
"dependencies": {
"mypackage": "user/mypackage#v1.0",
"mypackage": "user/mypackage#v2.0"
}
At the end, I want to A/B test my package with different versions. Thanks a lot !
Based on npm discussion, this won't be implemented any time soon.
Some reference:
https://github.com/npm/npm/issues/5499
https://github.com/npm/npm/issues/2943

angular bootstrap older versions removed from npmjs?

We had been using version 0.11.0 of angular-bootstrap from npmjs. It appears that version is no longer available on npmjs. From the commands below does this mean that someone actually unpublished the older packages?
prompt:~$ npm view angular-bootstrap time
{ modified: '2015-01-12T06:48:54.881Z',
created: '2014-01-29T21:54:32.213Z',
'0.0.1': '2014-01-29T21:54:37.589Z',
'0.0.2': '2014-01-29T22:03:08.814Z',
'0.0.3': '2014-01-29T22:51:49.998Z',
'0.0.4': '2014-02-11T15:14:17.078Z',
'0.11.0': '2014-06-24T07:06:56.435Z',
'0.13.0-SNAPSHOT': '2014-12-02T13:05:43.151Z',
'0.12.0': '2015-01-12T06:46:41.986Z' }
prompt:~$ npm view angular-bootstrap versions
0.12.0
I agree, the package seems to have been unpublished. You can still access it from the github history, as follows:
$ npm install "angular-ui/bootstrap#0.11.0"
(note that you may not need quoting, but some shells will interpret the # as a comment-begin character.) You can also use this syntax in dependencies inside package.json
If you have a project in production that depends on this, you should probably make a fork of the angular-ui/bootstrap repository and point towards that.
(I had some difficulty making this work on Windows, but it looks like you're on a Unixy system, so you should be fine.)
Ticket discussing this and the future is at https://github.com/angular-ui/bootstrap/issues/1636