I'm relatively new to jspm. I wanted to know what the difference is when is run jspm install package
and npm install package
. I know that there is a lookup with jspm/registry. But what's the difference when it comes to setting up config.js
. Are there any additional changes to be made if the package is installed using npm?

- 3,649
- 2
- 14
- 16
2 Answers
npm and jspm are both package managers.
npm is used for the node ecosystem, and traditionally served back-end dependencies.
To enforce the separation between front-end and back-end, developers used tools specifically for front-end. There came bower and the likes... as well as jspm.
I wanted to know what the difference is when is run
jspm install package
andnpm install package
.
Here are some differences between npm and jspm:
- jspm stores its dependencies in jspm_packages
whereas npm stores them in node_modules
- jspm uses a flat dependency tree
- jspm allows you to configure arbitrary registries to get your dependencies from (github and npm are configured by default)
- even if jspm tracks module declaration and mapping, as well as configuration, into its own file (config.json), it actually defines the project dependencies inside the package.json (within the property jspm
)
- you could use jspm packages either for a jspm project, or for a node / web project
- jspm is in fact just a package manager which wrap around the configuration system of SystemJs
So when you install a package from jspm it uses SystemJs configuration and set up the mapping between the dependencies, allowing you to export the project as any module types (AMD, CJS, esm, umd ...).
Are there any additional changes to be made if the package is installed using npm?
jspm install package
makes a lookup in the jspm registry.
If no package is found, it means that you have to specify from which registry this package is coming from.
For an npm package it is: jspm install npm:package
.
You can of course specify a specific version by appending @version
at the end of the package name.
jspm also allows you to declare a shorthand to map this library within your code.
for more info see documentation: http://jspm.io/docs/installing-packages.html

- 386
- 4
- 13
Both are package managers and essentially do the same function however here are some differences:
- Npm will track packages in the package.json file whilst jspm will use the config.json file.
- Npm will store it's packages in a node_modules folder whilst jspm will use a jspm_components folder.
- Jspm is more commonly used to bring in client-side\front-end libraries and npm for server-side ones.
Restoring packages will normally follow like this:
- Run
npm install
(should install jspm amongst other libraries) - Run
jspm install

- 7,360
- 5
- 37
- 63
-
1Once I have jspm installed (using npm) then when I install devDependencies or dependencies, what's the difference in installing them using jspm install `package-name` and npm install `package-name`. Also how are these separately dealt with in my project? – Sahil Jain Aug 27 '16 at 13:03
-
One ends up in the jspm_packages folder and the other in the node_modules folder. Jspm can load modules from different sources and usually the preferred option for work involving more client-side libraries. The two package managers also take a different strategy in dependency management. – Naeem Sarfraz Sep 25 '16 at 05:48