can't build yeoman angular app - angularjs

I have a problem with building an angular js web app generated with yeoman angular generator. I can run the grunt serve, and it's completely fine. But when I tried to build the app using grunt, I got the following errors.
Running "concurrent:dist" (concurrent) task
Warning: Running "imagemin:dist" (imagemin) task
Warning: Error: spawn ENOENT in file app/images/yeoman.png Use --force to continue.
The thing is I can build that app (exactly the same app, just copy and paste) on other latop, using same OS, same npm version, same grunt version.
I'm using:
mac osx - v10.9.5
npm - v2.0.2
grunt-cli - v0.1.13
grunt - v0.4.5
yeoman - v1.2.1
Please, help me how to fix that error. thanks

You have to update imagemin. (You may edit imagemin version at your package.json).
I observed the same issue with imagemin 0.8.2. Imagemin 0.9.2 works fine for me.
Imagemin 0.9.2 require npm version >=2.1.5, you have to update npm too(npm install -g npm).

Related

Yeoman/Gulp throwing 'spawn gulp ENOENT' error on a Mac

Please note: I do see this question as well as this one but those were both instances where the developer was on Windows, and the solution was Windows-specific. I am on a Mac! Please don't closevote as a duplicate!!!
Mac 10.12.6 here. I'm new to AngularJS (v1.x) and am trying to follow this tutorial on using Yeoman to create an internationalized AngularJS app.
I install the Yeoman AngularJS generator and create a directory for my simple/test app:
npm install -g generator-angular
mkdir angular-translate-yeoman && cd $_
Then I go to create my internationalization AngularJS app:
yo angular translate
It asks me a bunch of questions, I select gulp instead of grunt, and then starts generating the scaffolding. About a minute later I get the following error:
events.js:160
throw er; // Unhandled 'error' event
^
Error: spawn gulp ENOENT
at exports._errnoException (util.js:1020:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:367:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
Anybody have any idea what the problem is and what the fix is?
I'm leaving this question up rather than deleting it. The problem was that I didn't have gulp installed, and the tutorial I was using never bothered to mentioned installing gulp as a pre-requisite. Not knowing anything about Yeoman, I guess I figured it would install any JS dependencies for me.
So this is the error you'll receive when you're on a Mac and using Yeoman + Gulp together, but Gulp isn't installed on your machine. To install Gulp:
npm install gulp-cli -g
npm install gulp -D
touch gulpfile.js
gulp --help

create-react-app: Template was precompiled with an older version of Handlebars

I just installed create-react-app package following the instructions on https://github.com/facebookincubator/create-react-app.
After that I've followed the instructions and created a "myapp" app:
$ create-react-app --version
1.0.4
$ create-react-app myapp
Creating a new React app in /home/...mydir.../myapp.
Installing packages. This might take a couple minutes.
Installing react-scripts...
After the list of installed packages I've got:
Success! Created myapp at /home/...mydir.../myapp
Inside that directory, you can run several commands:
npm start
Starts the development server.
npm run build
Bundles the app into static files for production.
npm test
Starts the test runner.
npm run eject
Removes this tool and copies build dependencies, configuration files
and scripts into the app directory. If you do this, you can’t go back!
We suggest that you begin by typing:
cd myapp
npm start
Happy hacking!
Ok, but when I'm running the server I've got the following message on browser console:
Template was precompiled with an older version of Handlebars than the current
runtime. Please update your precompiler to a newer version (>= 4.0.0) or downgrade
your runtime to an older version (>= 2.0.0-beta.1).
I've verified the handlebars version :
$ npm ls|grep handlebars
│ │ └─┬ handlebars#4.0.6
I've also tried to set the handlebars version on package.json under "devDependencies" and "dependencies" but that didn't work.
Any ideas on how to solve this?
This is a bug in Code Climate Chrome extension.
If you uninstall it, the error will go away.

Angular Gulp setup with latest NodeJS version

I have been following the repo A healthy Gulp Setup for the gulp setup of my AngularJS project.
I can successfully proceed with this in an older version of nodejs. But on my another system, I have installed a newer version "NodeJS 4.2.2" and I get many dependency errors.
At initial try of npm install I got the error
npm WARN engine karma#0.10.10: wanted: {"node":"~0.8 || ~0.10"} (current: {"node
":"4.2.2","npm":"2.14.7"})
I tried modifying the karma version in package.json from 0.10 to 0.13. This time the npm install hangs for hours while processing bufferutil.
C:\wamp\www\ros_ui\node_modules\karma\node_modules\socket.io\node_modules\socket
.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\bufferutil
>if not defined npm_config_node_gyp (node "C:\Program Files (x86)\nodejs\node_mo
dules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
) else (node rebuild )
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
bufferutil.cc
win_delay_load_hook.c
Creating library C:\wamp\www\ros_ui\node_modules\karma\node_modules\socket
.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\
ws\node_modules\bufferutil\build\Release\bufferutil.lib and object C:\wamp\ww
w\ros_ui\node_modules\karma\node_modules\socket.io\node_modules\socket.io-cli
ent\node_modules\engine.io-client\node_modules\ws\node_modules\bufferutil\bui
ld\Release\bufferutil.exp
Generating code
Finished generating code
bufferutil.vcxproj -> C:\wamp\www\ros_ui\node_modules\karma\node_modules\sock
et.io\node_modules\socket.io-client\node_modules\engine.io-client\node_module
s\ws\node_modules\bufferutil\build\Release\\bufferutil.node
Is there any work around for this? I would prefer going with latest node version.
Any help would be appreciated. Thanks in Advance.
Try angularcoffee-boilerplate, this is a project template for AngularJS where npm and Gulp are preconfigured. Just clone the project, install prerequisites with the script install_prerequisites.bat and start the server with the command npm start

Yeoman - Errors With Grunt Server Command

I already have npm and git installed on my Ubuntu machine.
I followed the instructions below when installing Yeoman and the generator-angular.
Kickstart Your AngularJS Development with Yeoman, Grunt and Bower (step by step tutorial)
http://www.sitepoint.com/kickstart-your-angularjs-development-with-yeoman-grunt-and-bower/
My ultimate goal is to lauch a simple app using twitter bootstrap, so I can take advantage of their pretty UI. :D
However, when I get to the portion to run grunt server (recently replaced by grunt serve), I get a rediculous number of errors:
I was previously suffering from the issue described below:
Cannot install yeoman because 'generator-karma does not satisfy its siblings peerDependencies
https://github.com/yeoman/yeoman/issues/1065
Luckily I was able to work around it by running npm uninstall -g generator-karma && npm install -g generator-angular and then sudo npm install -g yo grunt-cli bower.
However, now I've hit a wall with grunt appearing as if it's not installed at all.
Does anyone know if there is a specific location where grunt should be installed?
Should I install it globally (using -g)?
Should I not install it globally (using -g)?
I don't understand what I'm doing incorrectly, but it must be something fundamental because the process is intended to be automated and simple.
Any ideas?
This looks like something npm install would fix. Looks like some of your dependencies didn't install.
Try it first without -g.
The problem definitely has something to do with compass and ruby. I was able to quickly build an angular app using yeoman when I opted not to install compass/sass for the app when prompted after typing yo angular at the terminal. After following the suggestions in this post, the last error I got was the following error:
Warning: /home/ubuntu/.rvm/rubies/rubie-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_req‌​uire.rb:55:in 'require': cannot load such file -- compass (LoadError) from /home/ubuntu/.rvm/rubies/rubie-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_req‌​uire.rb:55:in 'require' from /usr/bin/compass:20:in 'block in ' from /usr/bin/compass:8:in 'fallback_load_path' from /usr/bin/compass:19:in '' Use --force to continue Although, --force doesn't help.
but fixed it by simply following these instructions.

How yeoman install somePackage works?

When I run yeoman install handlebars I get the following output:
Running "bower:install:handlebars" (bower) task
bower cloning git://github.com/components/handlebars.js
bower cached git://github.com/components/handlebars.js
bower fetching handlebars
It doesn't copy handlebars to the current project's plugins or vendors directory. It exits without an error message. Is this the right behaviour?
To me it seemed like a bug so I've created an issue on yeoman's github page. But I'm not sure.
To resolve this issue here's what I did. I realized yeoman did not install bower for me and it depends on bower for installing libraries. So, to resolve this issue - install bower manually like this: npm install bower -g

Resources