Installing 2 year old application - angularjs

I started a project 2 years ago that I now can't seem to install into other directories.
I used to follow these steps to install my angular frontend
npm install gulp
npm install typings
npm install
typings install
gulp build
I never had to do them again and it correctly installed a typings folder from which the gulp file found all it packages, it worked and I didn't mind how.
I am now trying to install it again and it does not fill the typings folder correctly, there only appears a index.d.ts file.
I found here https://github.com/typings/typings/tree/abea10b5787e1a18634d5f37bb2fa56550c32fd1
that it should've been around version 1.0.4.
So I try to install with:
npm install typings#1.0.4
But this still does not install any typing directory.
Any direction I should look into further would be apreciated.

If you look have a package.json file for the 2 year old project (which you should) then you should find the version numbers of each dependency in there.

Putting all my files in the package.json to the specified version an not just compatible with changed the error to Syntax error parsing, I was able to fix that with removing a translate application.

Related

Simple NPM Question Re-updating local react project after other dev added new package

I just started working with vscode and npm/git. Someone on my team added a package and I did a pull to get his latest changes which put that package in my package.json file. When I ran the project I got errors for a module not being found. Obviously I need to install that package locally. Do I simply use npm install w/no arguments to get it? Or do I install it manually myself with npm install and version info? I ask because I don't know if npm install w/no args will create a new package.json or cause any issues.
What is the correct way to get a new package installed that someone added in the repo?
npm install can be run as many times as you like, and is what you should be doing here :)
npm install's purpose is to get your node_modules folder up-to-date with whatever is written in package.json
So, if your colleague has changed package.json (by installing something new and pushing the change to git), you can just run the command again to get up-to-date.
Provided you haven't directly fiddled with any files in node_modules (this folder should be left alone), it is always safe to run npm install as many times as you like, even if nothing has changed.

npm installation error CLI

I tried to install npm and run angular project but there is a warning
I ran this command npm install -g #angular/cli after installing git and node
you are missing package.json from your project. Since you have installed angular/cli globally, you should just create new project as ng new nameofproject
See here for more info https://github.com/angular/angular-cli
You need to have package.json file using which npm downloads dependencies for the project. Create a new project with the following command ng new projectName.
You are here:
C:\xampp\htdocs\angular>npm install
instead use:
C:\xampp\htdocs\angular>ng new myangular-app
When you do this it will create and download all the required files and dependencies. After this you are good to go then.
Hope this helps!
PS: Please have patience, as this can take some time to set up your new project. (It will download all the required files and dependencies to node_modules folder).

Angular-phonecat getting started (Bower install) fail

my problem is described in the following image:
The main problem is that im getting a: Bower ENOENT no bower.json present error and as you can see in the image (second command) the file is actually present. So ive been trying to find what actually bower install does and havent found it in the NPM documentation and Git documentation as well
Also, in the research ive done some forums suggest installing bower globally and it hasnt worked
Since i've been googling for about 3 nights looking for somebody with the same problem and havent found anybody else with the problem I started wondering about if I changed any environment variable. So i uninstalled node.js and Git and then reinstalled both programs without any change in the result
Hope somebody can help me with this, thanks in advance
Bower is a package manager for HTML http://bower.io/. 'bower install' will download all the packages listed in bower.json and add them to a folder called 'bower_components'
You must have bower install globally via
npm install -g bower
To get a list of NPM packages installed successfully global use:
npm list -g
Having a look at the github issues of that Repository(Angular-phonecat) theres alot of issues related to bower(https://github.com/angular/angular-phonecat/search?q=bower&type=Issues&utf8=%E2%9C%93), which is strange because bower is not that complicated. Have you looked through any of those fixes.

Package dependencies in NPM and Bower

First time user of npm and bower. I am able to install packages correctly but I am not sure how the dependencies work? As an example, I did "npm install angularjs" in my application root which created a folder "node_modules/angularjs/" with some files in it. I can also see that there is a package.json file within the angularjs folder, and it looks like it has not been processed as there is numerous packages listed in it and not installed.
Long story short, should I install all these packages manually or is there a built in feature that npm/bower can also process these sets of dependencies?
UPDATE:
I greatly lack the ability to ask precise questions, I apologise to those who have answered and did not give the correct sypnosis.
What I expect to happen:
Using npm or bower, I want to clarify that if I do an install of one of their packages, will it automatically also install the new package's dependancies or would I need to do a npm/bower install for each of the packages.json or bower.json files manually?
What I did to try make it work:
Created folder D:\Websites\TestSite
Within the folder through CMD, I did a "npm init" and ran through the guide
I followed that up with a "npm install angularjs"
A new folder was created D:\Websites\TestSite\node_modules\angularjs and within this folder there was a "index.js" and package.json file
Opening index.js I get a "require("angular");" and module.exports = window.angular.
The package.json file contains a number of dependancies which has not been installed.
My Result:
As per my expectations, npm install in point 3 above did not install the dependancies of the package.json file after it installed angularjs.
I am not sure but I assume that the index.js file needs to be included in my html and that it required the requirejs library initiated? If this is the case, then requirejs (which I do not have installed on my site) should be a dependancy for angularjs to work, and should be installed prior to giving me the ability to try and initiate it?
Am I missing a step or misunderstanding the functionality of NPM/Bower? Thank you for your patience!
Npm and Bower are great tools for managing your dependencies, i'll try to make it clear in a few words.
In general npm is used for managing your back-end dependencies and Bower is responsible for your front end dependencies.
There are 2 config files:
package.json, here are listed your dependencies that are not used in browser(e.g. bower, grunt). To install all dependencies in package.json run npm install.
Bower.json, here will be listed your "in browser" dependencies(e.g angular, jQuery). Run bower install to install all dependencies listed here in bower_components
You can find a extended guide i wrote here.

What is causing 'grunt serve' to throw 'No Bower components found'?

I am starting out angular app with angular-fullstack in my Windows 7 box. I installed bunch of npm packages with -g options, including grunt-bower-install. I created the application first by running
yo angular-fullstack appname
There were no exception during the application creation. After application was created successfully I tried to run the app using
grunt serve
expecting the server to run. But the 'grunt serve' failed with
Running "bower-install:app" (bower-install) task
Cannot find where you keep your Bower packages.
We tried looking for a .bowerrc file, but couldn't find a custom
directory property defined. We then tried bower_components, but
it looks like that doesn't exist either. As a last resort, we tried
the pre-1.0 components directory, but that also couldn't be found.
Unfortunately, we can't proceed without knowing where the Bower
packages you have installed are.
Fatal error: No Bower components found.
I did find .bowerrc file and it was pointing to app/bower_components. Unfortunately, bower_components file was no where to be found. I am not sure what should be the content of the file to create it myself. Is it the missing file causing this problem or is there a npm package, I did not install correctly?
I installed bower using npm as well *
Thanks
Confusingly, the grunt-bower-install task that comes with angular-fullstack doesn't install bower components. It doesn't install anything. This error is trying to let you know that it can't find the bower_components directly, so it can't do its thing.
To fix the issue, run bower install.
If you don't have Bower installed, run npm install -g bower first.
I had the same issue, here's what worked in my case:
installed ruby and compass (yeoman needs these)
verified that path to Ruby bin folder is added to %PATH%
installed Git
restarted cmd window and ran "bower install" in the app folder
After that, grunt serve command worked perfectly.
Note: maybe installing Git and running bower install would suffice in your case.
I faced the same problem but only did npm install -g bower and then bower install and got grunt serve working.
I did not need to do any of the things mentioned by Olga.
Hope this helps.
npm install -g bower doesn't install bower components, you should run as well bower install to have all bower's components installed and then run grunt serve. It should work fine
Try to do bower install. If its failing saying not able to connect to git then you can change repo pointing location by simply running below command
$ git config --global url.https://github.com/.insteadOf git://github.com/
This will ensure that you will be downloaded over https instead of git if its causing orginasation firewall to block it.
In my case, I added sudo for it to work. So, I ran sudo npm install -g bowerand then bower install. grunt serve then worked when I ran it.
The Bower installation requires the packages to be brought from the Git repository, so first you need to install the Git application in your system. You can download it from this link :https://git-scm.com/downloads . Now after your have downloaded it , there may be a chance that the PATH may not be set up, so go to ControlPanel -> System and Security -> System -> Advance System Settings (on the left-hand side), click it, then goto Environment Variables -> System Variables -> PATH , click edit , and write down the following paths :
;C:\Users\admin\AppData\Local\Programs\Git\bin;
C:\Users\admin\AppData\Local\Programs\Git\cmd ....Well the above path is where Git was installed in my system, you can crawl to the place in your system where Git was installed and select the paths from the "bin" and "cmd" folder and paste it on the PATH variable.
Now, after the GIT path is setup, you can now type in the command " $ bower install " , this will install all of your bower packages.
npm install -g bower
bower install
grunt serve
worked for me ...
npm install -g bower
bower install
grunt serve
It's worked too

Resources