r.js is missing when I install requirejs through bower, why? - requirejs

r.js is missing when I install requirejs through bower, why?
I installed bower globally and then I install requirejs
bower install requirejs
it installs all the stuff and no error happens:
bower cloning git://github.com/jrburke/requirejs
bower cached git://github.com/jrburke/requirejs
bower fetching requirejs
HEAD is now at c94b6fe Merge pull request #809 from tapsboy/master
0.10.0
0.11.0
0.12.0
0.13.0
0.14.0
0.14.1
0.14.2
0.14.3
0.14.4
0.14.5
0.15.0
0.2.0
0.2.1
0.22.0
0.23.0
0.24.0
0.25.0
0.26.0
0.27.0
0.27.1
0.8.0
0.9.0
1.0.0
1.0.1
1.0.2
1.0.3
1.0.4
1.0.5
1.0.6
1.0.7
1.0.8
2.0.0
2.0.1
2.0.2
2.0.3
2.0.4
2.0.5
2.0.6
2.1.0
2.1.1
2.1.2
2.1.3
2.1.4
2.1.5
2.1.6
2.1.7
2.1.8
latest
Previous HEAD position was c94b6fe... Merge pull request #809 from tapsboy/master
HEAD is now at a77a30a... Rev for 2.1.8
bower checking out requirejs#2.1.8
Removing bower.json
2.1.8
bower copying C:\Documents and Settings\Administrador\Application Data\bower\cache\requirejs\ca377b0e482cd657ed20ebfa063ade1a
2.1.8
bower installing requirejs#2.1.8
I was expecting to find a bin directory and a file named r.js in it!
Update:
If I install
npm install requirejs
Note that now is npm instead of bower it creates the bin/r.js file too.
What is the problem and differences between the npm and bower packages?
thanks (:

A bower install will clone a git repo into the components folder of your project. So bower install requirejs will clone the requirejs repo. But r.js is not part of this repo but has its own. You can download the compiler with bower by bower install r.js
With npm install requirejs you get a special package created by the maintainer of requirejs, who buts the r.js file into the package.
So the main difference between bower and npm is that bower links to a git repo while npm links to special package created by the publisher.

Related

Installing different versions of the same package with npm/yarn

I have two versions of a package e.g.
#mycompany/mylob v2.0.0
and
#mycompany/mylib v3.0.0
version 3.0.0 has breaking changes from version 2.0.0 but we do not have the capacity to upgrade everything to 3.0.0 as of yet.
Another developer has upgraded an internal package e.g. #mycompany/utils to use version 3.0.0 and that is installed into our codebase so now we are getting compatibility errors when running the build as #mycompany/utils requires version 3.0.0 but the rest of the code in that repository wants version 2.0.0.
Is there a way with yarn/npm that I can install #mycompany/mylib v3.0.0 for #mycompany/utils and have the rest of the code refer to v2.0.0?
You can use custom alias installs:
npm i custom-name:#mycompany/mylib#3.0
You can change custom-name to any valid package name you want to use.
After that you can import the package with this alias name. e.g.:
require("custom-name")/ import * from "custom-name"
For npm install specific version, use npm install [package-name]#[version-number].

How to install compatible dependencies versions for NodeJs using NPM

If I install the latest version of node from nodejs.org, how do I install the dependencies that are compatible with the version.
For example of dependencies:
material,
animation,
cdk,
flex-layout, etc.
How to install using the npm
Many node modules have in their package.json file set on which node version they can work.
You can check How can I specify the required Node.js version in packages.json?
and npmjs.com/files/package.json#engines how it is done.
So for example, #angular/material has in package.json this:
"engines": {
"node": ">= 5.4.1"
}
That means that if you have a version of node that is bigger than 5.4.1 a current version of #angular/material is compatible and it will be installed using:
npm i #angular/meterial
For detailed information about installing modules using npm you can check npm-install/Install a package.
Once node is installed you can begin using the "node package manager" or npm.
First you will need to create a package.json file to maintain your packages.
Navigate to the root of your project folder. Ex:
C/user/repo/my-project
And then initialize the package manager:
npm init
Follow the onscreen instructions and a package.json will appear in this folder.
Now you will be able to install packages.
Here is an example of how to install material:
npm install material
or short hand
npm i material
This will install the package in the folder you are running the command.
You may want a global install. Installing globally will give all of your projects access to the package. If you want to install it globally try this:
npm i -g material
-g mean 'global'
Find out more here: https://docs.npmjs.com/

Error on “npm install socket.io” version 1.0.0

i want to install socket.io version 1.0.0 but npm gives me the error "version not found"
It is possible not to publish every incremental version of an package. It is possible that version 1.0.0 was never published, therefor you cannot install it. try:
$npm install#1.0.1

Why "wanted" is not "latest"?

I am using npm outdated -g --depth=0 to see which globally installed packages have newer version. I am getting this:
$ npm outdated -g --depth=0
Package Current Wanted Latest Location
bower 1.6.8 1.6.8 1.7.1
jshint 2.8.0 2.8.0 2.9.1-rc2
jspm 0.16.13 0.16.13 0.16.19
npm-windows-upgrade 1.0.1 1.0.1 1.2.0
typescript 1.7.3 1.7.3 1.7.5
I can not update any of those packages. npm update -g does nothing. Why Wanted field is has lower version than Latest? I am using windows 7, node 4.2.1 and npm 3.5.2
Since these are global packages there is no package.json to direct their update policy. By default "wanted" version is the same as installed or "current" for global packages. That means npm update will not update them saying that they are at the most recent wanted version.
In order to update them use npm -g install .... Install will use "latest" version from the repository.
npm update -g shouldn't do "nothing" -- you should try npm update -g --verbose and see what that has to say.
I've had to run npm update -g a few times in succession to get it to update everything to the latest.
I just ran into this same issue and had a different solution not yet mentioned. My issue was that my package.json had semantic versioning constraints associated with versions. Given your package bower, for example, with a current/wanted version and of 1.6.8 and a latest version of 1.7.1, it could be possible that your package.json file shows:
"dependencies": {
"bower": "~1.6",
}
Running npm update bower would not update bower past version 1.6 to version 1.7 because of the ~ prefix; to get around this you can run npm install bower#latest to bypass the semantic versioning constraints.

npm outdated and npm update doesn't work

I want to check if my modules are Latest
i do: sudo npm outdated
and I have this results
Package Current Wanted Latest Location
oauth 0.9.9 0.9.9 0.9.10 twit > oauth
require-all 0.0.3 0.0.3 0.0.8 mysql > require-all
bignumber.js 1.0.1 1.0.1 1.3.0 mysql > bignumber.js
request 2.27.0 2.27.0 2.30.0 facebook-chat > node-xmpp > node-xmpp-client > request
through 2.2.7 2.2.7 2.3.4 facebook-chat > node-xmpp > brfs > through
then i do this:sudo npm update
but if I repeat sudo npm outdated i have the same results...
also if I do for example
Info:
Package Current Wanted Latest Location
oauth 0.9.9 0.9.9 0.9.10 twit > oauth
Then Update
sudo npm update oauth
Then
sudo npm outdated oauth
My Result:
Package Current Wanted Latest Location
oauth 0.9.9 0.9.9 0.9.10 twit > oauth
Your project is actually as up-to-date as it can be currently.
NPM won't simply install the Latest version of a package unless that version is also Wanted.
The resulting field 'wanted' shows the latest version according to the version specified in the package.json, [...]
And, for each that you listed, the Wanted and Current versions already match.
Package Current Wanted ...
oauth 0.9.9 0.9.9 ...
require-all 0.0.3 0.0.3 ...
bignumber.js 1.0.1 1.0.1 ...
request 2.27.0 2.27.0 ...
through 2.2.7 2.2.7 ...
An attempt to force oauth to its current Latest of 0.9.10, for example, would actually be considered invalid as twit has 0.9.9 listed exactly:
"dependencies": {
"oauth": "0.9.9"
},
$ npm ls
...
└─┬ twit#1.1.11
└── oauth#0.9.10 invalid
npm ERR! invalid: oauth#0.9.10 ...\node_modules\twit\node_modules\oauth
Check your package.json may be your packages or there there.
try to install package with --save and try it will work
example :
npm install underscore#1.5.0 --save
now try
npm outdated

Resources