regarding installing angular plugin by NPM or bower - angularjs

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.

Related

How to fix ReactJs Sass Not Compiling and error showing in vs code?

I am trying to use sass in my reactjs project and I tried
npm install node-sass
after install and import it with scss extension but not working it,
I used W3Schools Tutorial but still not working
error showing this
./src/myStyle.scss (./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-5-1!./node_modules/postcss-loader/src??postcss!./node_modules/resolve-url-loader??ref--6-oneOf-5-3!./node_modules/sass-loader/dist/cjs.js??ref--6-oneOf-5-4!./src/myStyle.scss)
To import Sass files, you first need to install node-sass.
Run `npm install node-sass` or `yarn add node-sass` inside your workspace.
The error is:
Run npm install node-sass or yarn add node-sass inside your workspace.
This means that the node-sass was not found inside the node_modules folder of the reactjs project.
This problem can be fixed by explicitly installing node-sass inside the project folder (using --save option along with npm install inside the project folder)
cd react-js-project-folder
npm install --save node-sass
npm install --save node-sass must be run in the root of the react-js project, I.E., at the same folder where package.json is located.

Error : Installation of blur-admin with angularjs

I want to install blur admin theme with angular js
I have follow steps to install blur admin theme from below site
https://akveo.github.io/blur-admin/articles/002-installation-guidelines/
I got the error as below ,
I find for solution for that and found below commands to run
npm update
npm install gulp-sass
then again run
gulp serve
but still same error I got
In my system git is installed and my nodejs version is 8.9.4
Please help me to resolve this issue.
Seems like you have not installed gulp-sass module.
Install it by running npm following command
npm install gulp-sass#latest --save-dev
Make sure you have deleted node_modules folder before install module.

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.

Setting up grunt, bower, angular dev tools after cloning from github

I am trying to clone a project from github then set up the bower dependencies and grunt build / dev tools. When angular projects are initialy pushed to github, certain directories and files have been shed (since they are listed on the gitignore file). I am trying to figure out how to resurrect all these files necessary to locally run a project (that I find from browsing on github).
After cloning the project, I run the bower command so that it reads through bower.json:
% bower install
Then I run the grunt commands:
% npm install -g grunt-cli
% npm install grunt --save-dev
Why is the Gruntfile.js not automatically created when I run these terminal commands?
It also hangs up on an issue related to livereload but that evaporates after I run these:
% npm install --save-dev connect-livereload
% npm install
When I start a project from scratch with these yeoman and grunt commands, it automatically creates the Gruntfile.js and I can successfully get the project to auto-load in the browser:
% npm install -g generator-angular
% yo angular
% bower install angular-ui
% npm install --save-dev connect-livereload
% npm install
% grunt test
% grunt server
% grunt
But I am trying to master the technique of cloning a project from github and then setting up the project locally. I am close but currently I am also experiencing an issue with a missing Gruntfile.js. I would be very grateful for any direction you could provide. All the best,
Ben
Using Yeoman
You don't need to clone the project from GitHub.
You simply need to make a new (clean) project directory.
cd /new/project/directory
(Optional) Update NPM
npm update -g npm
Install angular scaffold
npm install -g generator-angular
Run yeoman scaffold
yo angular
Fire up a server
grunt server
Start building your app, perhaps with Angular sub-generators
yo angular:controller myController
yo angular:directive myDirective
yo angular:filter myFilter
yo angular:service myService
Using bower to install front-end dependencies
Search for repos to install
bower search dep-name
or, http://sindresorhus.com/bower-components/
See what all has been installed
bower list
or, see your bower.json file
Installing dependencies
bower install dep-name
or, add it to bower.json file then simply run bower install(Preferred)
Most of all, Read Documentation
Yeoman Getting Started
Bower
Grunt
I would recommend reading through Yeoman first. Get the hang of it, then move on to the other docs once you need more advanced customization for your project. Generally, the Yeoman docs cover bower and grunt well as it relates to your Yeoman project.
I get it working after do the following:
brew install nvm
source $(brew --prefix nvm)/nvm.sh
It will install nvm then you can controll your npm version (may you have problem with this with yo:angular project)
Then you should make sure that you are using npm 0.10
nvm install 0.10
nvm use 0.10
To avoid problems with previous npm installations cached you should use:
sudo npm -g cache clean
Now you are ready to get your yo:angular project working in your machine:
git clone <yourproject>
cd <your-project-directory>
npm install
It will install grunt and karma for you, then you should install all bower packages before start your dev server:
bower install
Then, finally, your project are done to be working so you can use:
grunt serve
:)

Resources