How install Start Angular template correctly? - angularjs

I'm new in the Angular development, so I found this template and I would like to use it. So I'm doing this:
sudo apt-get install -y nodejs
sudo apt-get install -y npm
sudo npm install -g bower
sudo npm install -g grunt-cli
Clone the repository of the project:
git clone https://github.com/start-angular/sb-admin-angular.git
cd sb-admin-agular
npm install bower
But when I try to execute the command npm start, it gives me the follow error:
vagrant#TheMachine:~/sb-admin-angular$ npm start
> sb-admin#0.0.0 start /home/vagrant/sb-admin-angular
> grunt serve
/usr/bin/env: node: No such file or directory
npm ERR! weird error 127
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! not ok code 0
vagrant#TheMachine:~/sb-admin-angular$
Any idea how to solve that ? Or what is causing it ?

You might be missing some dependencies. Looks like you only installed bower. Try installing all dependencies using
npm install
Re-follow the installation instructions on the Github page from 5-7:
npm install - bower install is ran from the postinstall
npm start - a shortcut for grunt serve
npm run dist - a shortcut for grunt serve:dist to minify the files for deployment

Some installation routines requires to find the binary "node".
But on Debian based systems the binary is named "nodejs".
To get around this problem I created a syslink.
But be aware that this may introduce other problems later.

Related

How to resolve ':react-native-vector-icons' error for a successful build?

I am trying to build my react-native app but I am getting an error:
What went wrong: A problem occurred configuring project ':react-native-vector-icons'.
Could not resolve all files for configuration ':react-native-vector-icons:classpath'.
Could not find any matches for com.android.tools.build:gradle:2.3.+ as no versions of
com.android.tools.build:gradle are available.
I have tried the following commands:
npm install
npm install npm -g
npm rm --cached
git clean -d -fx
npm cache clean --force
npm update
npm upgrade
npm audit fix
npm install react-native-vector-icons --save
I have tried everything I can find on how to resolve this but I cannot get this error to go away. Does anyone know how to resolve this react-native-vector-icons build fail error?
You have to uninstall the react-native-vector-icons plugin first. Then, reinstall it. Just type:
$ npm uninstall react-native-vector-icons$ npm install --save react-native-vector-icons

cannot read property 'apply' of undefined gulp

I am trying to use the ng-factory generator to scaffold a new project to build an angularjs component. After the project has been created with the yo ng-factory command, I tried to run it using the gulp serve task but found the following error:
c:\projects\bywebclient>gulp serve
[11:20:51] Loading C:\projects\bywebclient\gulp_tasks\browsersync.js
[11:20:52] Loading C:\projects\bywebclient\gulp_tasks\karma.js
[11:20:57] Loading C:\projects\bywebclient\gulp_tasks\misc.js
[11:20:57] Loading C:\projects\bywebclient\gulp_tasks\webpack.js
[11:21:07] Using gulpfile c:\projects\bywebclient\gulpfile.js
C:\Users\ATUL KALE\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:129
gulpInst.start.apply(gulpInst, toRun);
^
TypeError: Cannot read property 'apply' of undefined
at C:\Users\ATUL KALE\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:129:
19
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
at Module.runMain (module.js:577:11)
at run (bootstrap_node.js:352:7)
at startup (bootstrap_node.js:144:9)
at bootstrap_node.js:467:3
Am I missing something? I already tried to run again the npm install
Thanks,
Atul Kale
Try to reinstall gulp-cli :
npm install -g gulp-cli
npm install -g gulp-cli
And important: after running that command, open a new terminal so it'll take effect.
Upgrade to 4.0 like this:
npm install --save-dev github:gulpjs/gulp#4.0
Uninstall the global gulp installation and local gulp-cli installation. While keeping global gulp-cli and local gulp packages.
npm uninstall -g gulp
npm uninstall -g gulp-cli
npm install -g gulp-cli
npm install --save-dev github:gulpjs/gulp#4.0
I get below error everytime i run
npm install gulp -g --save
TypeError: Cannot read property 'apply' of undefined
at /usr/local/lib/node_modules/gulp/bin/gulp.js:129:20
at _combinedTickCallback (internal/process/next_tick.js:132:7)
at process._tickDomainCallback (internal/process/next_tick.js:219:9)
I tried:
npm i -g gulp-cli
and it works for me.
If again i run
npm install gulp -g --save
the above error returns. I noted when i first installed Gulp it was saved in my package.json but now it's absent.
I tried uninstalling both gulp and gulp-cli from my machine (locally and globally), but after uninstall gulp -v, it still showed Gulp CLI 3.9.1, even in new terminal window.
In the end, these are the steps that finally worked for me (seems like CLI simply got cached hard):
Navigate to your project and delete node_modules folder.
Run following:
npm uninstall gulp --global
npm uninstall gulp-cli --global
apt-get remove npm
apt-get remove nodejs
apt-get install nodejs
apt-get install npm
npm install --global gulp-cli
Navigate to your project and run:
npm install
Close current terminal, open new one and check for success:
gulp -v
Should say CLI version 2.1.0 (as of time of writing).
Now you can run your gulp tasks without that error :)
In my case, I had an automated script which was doing npm install gulp (...) and until v3.9x it was fine.
After some time, that naive install would pick v4.0.0, which breaks my CI.
Changing the script to do npm install gulp#3.9.1 reverted things back to normal.
Reinstall gulp and gulp-cli, to install the last version.
npm uninstall -g gulp
npm uninstall -g gulp-cli
npm install -g gulp-cli
npm install -g gulp
And then, close the terminal and open new.
*This command no longer works: npm install --save-dev github:gulpjs/gulp#4.0

npm start returns error 127 while setting up angular-seed application

I am trying to setup angular-seed application.
I have installed nodejs with sudo apt-get install nodejs
Installed npm with sudo apt-get install npm
Installed bower with sudo apt-get install bower -g
Installed nodejs-legacy with sudo apt-get install nodejs-legacy
Opened my angular-seed application, ran npm install. This ran perfectly without any errors.
To start the server, I'm trying to use npm start, but it is returning the following information and error.
> angular-seed#0.0.0 prestart /home/venki/Downloads/angular-seed
> npm install
> angular-seed#0.0.0 postinstall /home/venki/Downloads/angular-seed
> bower install
> angular-seed#0.0.0 start /home/venki/Downloads/angular-seed
> http-server -a localhost -p 8000 -c-1
sh: 1: http-server: not found
npm ERR! weird error 127
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! not ok code 0
I'm using Ubuntu 14.04 LTS. Please let me know if any further information is necessary.
I assumed that http-server will be installed by default by nodejs but it turns out that it doesn't.
I installed http-server using
sudo npm install -g http-server
Just ran npm start after this. That's it, the problem is solved.
I had to run both the following commands;
sudo npm install -g http-server
apt-get install nodejs-legacy
And then my program trying to use NPM operated correctly.
I installed nodejs-legacy using the following:
apt-get install nodejs-legacy
Then just run npm after this.

Local Npm module "grunt-legacy-util" not found. Is it installed?

i have a problem with grunt serve,(i dont know if it's normal) grunt serve said me "works without errors" but the first message is local npm module "grunt-legacy-util" not found. Is it installed?", i need to delete node_modules folder and make npm install to can work with the server. i do grunt update, npm install grunt-legacy-util, npm install,npm update, but say same message...i use angularjs make with yeoman and webstorm, any idea please?
You can run a sudo command on it as perhaps the file isn't accessible/hidden (for some odd reason).
sudo npm install -g grunt-legacy-util
Check out this GitHub post should that not work: https://github.com/Widen/fine-uploader/issues/1165
It could also be that your NPM that is installed globally is clashing with the NPM in your root directory. Though unlikely.
This is what worked for me:
npm update
The running this following commands again fixed it for me:
npm install -g bower,
npm install -g grunt-cli,
bower install,
npm install.

Cannot use grunt on simple Yeoman angular

Trying to just startup a simple angular app via Yeoman, using steps in this guide
http://www.sitepoint.com/kickstart-your-angularjs-development-with-yeoman-grunt-and-bower/
and get this error when trying to run grunt or grunt server:
Loading "Gruntfile.js" tasks...ERROR
Error: Cannot find module 'load-grunt-tasks'
Warning: Task "default" not found. Use --force to continue.
Here are my versions:
yo --version && grunt --version && bower --version
1.1.2<
grunt-cli v0.1.13
grunt v0.4.4
1.3.1
See screencast of this in action:
http://screencast.com/t/4ToPw3SlL2
I just encountered the same problem today, managed to resolve it with the answers here.
Basically I needed to update npm to latest version,
by using this command (the npm which came with Node-v0.10.29 package was outdated)
npm update npm -g
or
sudo npm update npm -g (i used this command on my mac)
Then type this command
npm --version (it should show 1.5.0-alpha-4 or later version)
Then type the grunt serve command
grunt serve
If you still have issues, then try running these commands
npm install
or
sudo npm install (i used this command on my mac)
Then try grunt serve command again,
grunt serve
This time, it worked for me.
If it didn't, then try this command
bower install (i did not have to use this command)
Run the following commands from the directory that has the Gruntfile.js for your project:
npm install
npm install -g bower
bower install
This will install all npm and bower based dependencies for your project.
In the screencast at 1:18 it shows install errors tied to at least multimatch. load-grunt-taskis dependent on multimatch.
Installed "load-grunt-tasks" module locally
ie
npm install load-grunt-tasks
instead of
npm install -g load-grunt-tasks

Resources