Bower suddenly does not install all components - angularjs

So that's it. Weird stuff... Since this morning, when I type for example bower install angular-sanitize, I only get these files:
.bower.json
angular-sanitize.min.js.map
bower.json
package.json
README.md
If I download the package with npm install there's no problem at all:
angular-sanitize.js
angular-sanitize.min.js
angular-sanitize.min.js.map
bower.json
index.js
package.json
README.md
The same applies to any other package. It's like bower couldn't get the .js files or something. Any idea?

Related

How to configure npm and package.json in subdirectory Visual Studio 2019 v16.6?

I have a Visual Studio v16.6 .NET Core 3.1 app with an embedded React/Typescript app.
The react app code is located in the /ClientApp folder.
The package.json and node_modules are located within the /ClientApp (root folder).
When this project was in VSC2017, any changes made to the package.json were automatically updated in the node_modules folder.
In VSC2019 when the package.json is in the root folder, the npm dependencies are listed and updated when package.json is updated.
However, in VSC2019, when package.json is located in the /ClientApp folder neither the node_modules nor the npm dependencies are updated.
Question:
Is there a way to configure VSC2019 to look in the /ClientApp folder for package.json and update npm dependencies accordingly?

How to add module to package.json if it is already a global package?

I would like to have redux-thunk in my package.json, but use the globally installed version (not in my project-specific node_modules folder). Do I need to add it to my package.json manually? Using npm install -g redux-thunk doesn't add the package to my package.json. Also, when I run my react app and import redux-thunk, I get a module not found error even though redux-thunk is installed globally. Is this because I am required to have the package in my project's node_modules folder and not in the global installation location?
the -g flag installs it globally. If you want to add it to your package.json file go to the directory where your package.json file is and run:
npm install redux-thunk

regarding installing angular plugin by NPM or bower

sorry to ask a very basic question because i am not familiar with NPM and bower. just saw a hint to install a library based on angularjs.
just see it
npm install --save angularjs-gauge
bower install --save angularjs-gauge
i just like to know where NPM or bower will save the library ?
how can i specify path to save the lib in specific folder with NPM and bower. thanks
Create a Bower configuration file .bowerrc in the project root and specify the directory path.
e.g:-
{
"directory" : "public/components"
}
https://bower.io/docs/config/
Run bower install again.

How Yarn manages package.json and bower.json files, when both are present in my project's root folder?

In my project's root folder,both bower.json and package.json are present.
When using npm previosly,i do both npm and bower install seperately.Now i switched to Yarn.My question is, what happens when i do a yarn install?
Will all the dependencies from package.json and bower.json will get
installed?
please help.
Yarn decided to drop Bower support for now. Yarn won't look at your bower.json. You will need to do bower install aside from yarn.
https://bower.io/blog/2016/using-bower-with-yarn/
A newer article https://bower.io/blog/2017/how-to-migrate-away-from-bower/ explains on how to move your dependencies from bower to Yarn
The tool bower-away mentioned in the article will convert your bower.json contents to a package.json format (may need to run a few times to resolve all the dependencies) and this can then be installed with Yarn/npm/...
From what I understand, Yarn still doesn't look at bower.json
If you're like me and have npm packages installed in a different directory to bower packages, you can try npm install --prefix or yarn install --modules-folder. For Yarn, the folder used will be a replacement of node_modules, but make sure to have a read of https://github.com/yarnpkg/yarn/issues/1684

npm - install explained

I'm trying to grasp how npm install works.
Shouldn't this have installed all the dependencies in package.json ?
I wen't to the docs npm install
npm install (in package directory, no arguments):
Install the dependencies in the local node_modules folder.
1)
What i understood is when invoking npm install This package.json (/protractor/package.json) is not the place where npm will look for dependencies in the folder i am currently in.
In /node_modules there a are a bunch of packages each with it's own package.json
Why are they not getting installed ?
2)
When first cloning the app , i wen't into the root folder invoked npm install
And node models were created , and all the dependecies in ~/angular-phonecat/package.json were installed.
Why doesn't it work the same way from inside the protractor folder ?
Does it have something to do with the warning above ?
You are in an installed package. When you install protractor it automatically installs all it's dependencies because protractor is an NPM package. If you delete the "node_modules" folder in there and type npm install, it will reinstall everything. Note: this is not the purpose of npm.
NPM is used for when you have your own project and you store it on a repository, you can add all the dependencies so when a user downloads the repository they can just type npm install to get the dependencies from npm.

Resources