Can't run yeoman application with grunt, cdnify.js - node.js

I've project to join so I cloned repo from git. I have installed npm install and then bower install, but when I try to run the app with grunt serve command, console returns this:
Loading "cdnify.js" tasks...ERROR
>> Error: Cannot find module 'chalk'
Running "serve" task
Running "clean:server" (clean) task
Running "wiredep:app" (wiredep) task
Warning: ENOENT, no such file or directory '/home/tomek/dev/mobilas/app/bower.json' Use --force to continue.
Aborted due to warnings.
The thing is, I shouldn't really change neither Gruntfile.js nor bower.json file.

Link I referenced in comment above fixed it for me... just had to run
npm install chalk
in the project directory as a work around until they get one of the grunt dependencies fixed.

Running below commands should fix your errors...
$cd /home/tomek/dev/mobilas
$rm -rf node_modules
$npm install
Now you should be able to run your app with $grunt serve command

Related

A valid Gruntfile could not be found

I have followed this link to try to install a mean.js stack on an ubuntu server.
Regarding grunt, in /opt/mean, I have done
sudo npm install -g bower grunt-cli
sudo npm install grunt --save-dev
sudo npm install
However, grunt or grunt jshint inside the folder gives
A valid Gruntfile could not be found. Please see the getting started
guide for more information on how to configure grunt:
http://gruntjs.com/getting-started
Fatal error: Unable to find Gruntfile.
Note that npm start works, and http://server_domain_or_IP:3000 can display the sample application.
Does anyone know how to fix the grunt error?
As the error states, you do not have a Gruntfile and https://gruntjs.com/getting-started shows you an example of one.
Simply installing Grunt is not enough. When you run grunt it needs a configuration file (your Gruntfile) to run any tasks. The Gruntfile itself contains the tasks to be run.
You will need a Gruntfile.js in your project. you can create the same using the following grunt command.
grunt-init gruntfile
The above command will create the sample gruntfile.js file in your project.

Semantic UI "No gulpfile found"

I've been trying to install Semantic UI with npm. The website says to run the following code:
npm install -g gulp
npm install semantic-ui --save
cd semantic/
gulp build
Gulp seems to install correctly, as does Semantic UI. But when I run the last line, I get
No gulpfile found
I'm not sure what this could be from. Do I need to make a file before I run this command?
Thanks!
Run gulp build from inside of /semantic (not root)
Gulp is looking for a gulpfile in the same directory where the command is executed.
So, cd into the semantic directory and try running gulp build again. It should work as long as you see a gulpfile.js file and have followed all the steps from the Gulp quick start.

grunt install error: unable to find local grunt

I'm trying to run grunt but receiving this error. I have grunt installed globally and can run 'grunt watch' from other locations and it works for other files. I have a new project given to me which has less files, and it contains a package.json file (this seems buried, where I'd assume it should be closer to the root but I'm new to this). I try to run grunt watch from the root and receive the error message above. The package.json does not list grunt files as dependencies. Any help is appreciated. Thanks
The error is telling you that it's missing locally. npm scripts run things out of the node_modules directory, so install grunt locally to resolve it.
npm install grunt --save-dev

Node-sass error (try reinstalling)

I'm trying to build a front-end server and when I run grunt I get this error with a suggestion to reinstall node-sass.
Aborted due to warnings.
dev#ubuntu:~/ideaProjects/web-app$ grunt app:dashboard/dev-dashboard --force
Loading "sass.js" tasks...ERROR
Error: `/home/dev/ideaProjects/web-app/node_modules/grunt-sass/node_modules/node-sass/bin/linux-x64-v8-3.28/binding.node` is missing.
Try reinstalling `node-sass`?
The weird thing is that the file (binding.node) does exist, but it is in a folder named 'linux-x64-v8-3.14' not, 3.28. I tried naming the folder 3.14 that didn't work. I've tried everything I can thing of to get this fixed, npm install node-sass, npm update, even cleaning out the project and running npm install on a fresh build. But to no avail. I repeatedly get this error.
Has anyone seen this or know how to fix this? I am running Ubuntu 14.04 x64
Thanks!
I ran into basically the same error on Debian Linux with gulp-sass(basically same thing as grunt-sass but for gulp... both are just wrappers for the respective tool around node-sass which is a nodejs port of the actual SASS compiler libsass).
The node-sass project mentions in their README.md that only binaries for "popular platforms"(apparently Windows/Mac) are included and you may need to build for other platforms.
I was able to resolve the issue by explicitly re-running the install and build scripts for node-sass directly on the Debian machine. Here are roughly the steps:
From a command prompt on your linux machine, cd to your project directory
cd to the node-sass directory within your project source. Probably something like cd node_modules/grunt-sass/node_modules/node-sass based on your original post
node scripts/install.js
node scripts/build.js
Should see a message like Binary is fine; exiting.. This will have added the correct node-sass binary for the platform the scripts were run on.
Try to run your grunt build again and hopefully it should work!
I just ran npm install to install the project dependencies. Is there >something else I should run?(I'm new to web development. I'm a java/android >developer)
I do not thinks so. A basic set up, a project folder:
.
├── Gruntfile.js
├── node_modules
└── sass
└── main.scss
Gruntfile.js contains:
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-sass');
grunt.initConfig({
sass: {
options: {
sourceMap: true
},
dist: {
files: {
'css/main.css': 'sass/main.scss'
}
}
}
});
grunt.registerTask('default', ['sass']);
}
then run:
npm install grunt-sass
Now you should be able to run:
grunt
the above outputs now:
Running "sass:dist" (sass) task
Done, without errors.
Notice that the npm install grunt-sass commands should output something like that shown below, possible related to your error:
/
> node-sass#3.1.2 install /home/testdrive/sassgrunt/node_modules/grunt-sass/node_modules/node-sass
> node scripts/install.js
Binary downloaded and installed at /home/testdrive/sassgrunt/node_modules/grunt-sass/node_modules/node-sass/vendor/linux-x64-14/binding.node
> node-sass#3.1.2 postinstall /home/testdrive/sassgrunt/node_modules/grunt-sass/node_modules/node-sass
> node scripts/build.js
` /home/testdrive/sassgrunt/node_modules/grunt-sass/node_modules/node-sass/vendor/linux-x64-14/binding.node ` exists.
testing binary.
Binary is fine; exiting.

No /bower_components/ in Yeoman Webapp

I'm new to command line and yeoman, but it's something I have been too to explore and decided to follow the introduction into getting started with a Yeoman webapp.
I made sure my Ruby, Compass, Git and NodeJS were all installed before installing Yeoman.
I successfully installed Yeoman and the Generator-webapp.
Then I ran yo webapp in a directory and pulled down a webapp with Bootstrap, Sass and Modernizr.
However it doesn't appear to have created a bower_components for my dependancies, because when I run ls this is what I see
Andrew-Clarks-MacBook:project1 clk$ ls
Gruntfile.js app bower.json node_modules package.json
Then when I run grunt serve i get the following errors
Andrew-Clarks-MacBook:project1 clk$ grunt serve
Running "serve" task
Running "clean:server" (clean) task
Running "concurrent:server" (concurrent) task
Running "copy:styles" (copy) task
Done, without errors.
Execution Time (2014-04-18 04:28:49 UTC)
loading tasks 4ms ▇▇▇▇▇▇▇▇▇▇▇ 22%
copy:styles 13ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 72%
Total 18ms
Warning: Syntax error: File to import not found or unreadable: ../../bower_components/bootstrap-sass-official/vendor/assets/stylesheets/bootstrap.scss.
Load paths:
/Users/clk/Sites/project1
/Users/clk/Sites/project1/app/styles
/Users/clk/Sites/project1/bower_components
on line 4 of app/styles/main.scss
Use --trace for backtrace. Use --force to continue.
Aborted due to warnings.
Execution Time (2014-04-18 04:28:46 UTC)
concurrent:server 4.2s ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 100%
Total 4.2s
When I run bower install to try and get them I get the following message
Andrew-Clarks-MacBook:project1 clk$ bower install
bower jquery#~1.11.0 not-cached git://github.com/jquery/jquery.git#~1.11.0
bower jquery#~1.11.0 resolve git://github.com/jquery/jquery.git#~1.11.0
bower modernizr#~2.6.2 not-cached git://github.com/Modernizr/Modernizr.git#~2.6.2
bower modernizr#~2.6.2 resolve git://github.com/Modernizr/Modernizr.git#~2.6.2
bower bootstrap-sass-official#~3.1.0 not-cached git://github.com/twbs/bootstrap-sass.git#~3.1.0
bower bootstrap-sass-official#~3.1.0 resolve git://github.com/twbs/bootstrap-sass.git#~3.1.0
bower jquery#~1.11.0 ENORESTARGET No tag found that was able to satisfy ~1.11.0
Additional error details:
No versions found in git://github.com/jquery/jquery.git
If someone can help this command line / yeoman rookie (and i mean rookie) that would be fantastic.
Apologies if this query has come up before, I searched for a fair while before posting!
Go into your main.scss file, and on line 4, change the ../../ part to just ../
The the bower_components file is found under app/bower_components.
../ takes you up one level from the directory that main.scss is in, which is in this case is app/styles.
../../ takes you up two levels, when you only need to go up one.
Not sure why when you run yo webapp it does that, I had the same problem. It must be to do with a the new update.
I had a problem with the missing bower components folder and I changed from using the npm command line to GIT bash and then everything seems to work fine.
I had the same problem, everything was installed except the bower_components folder in the app folder.
Untill I used GitBash instead of cmd, and it worked like a charm!
Folks, i faced the same issue [ and am not familiar with GitBash] , but i managed to resolve it after i followed bower install procedure to manage third party dependencies. More help here https://github.com/yeoman/generator-webapp
There was an issue with webapp that looks to have been resolved in newer versions.
webapp - relative references.
Also, you can check to see if you have bower installed:
bower -v
If it is not installed then install it:
npm install -g bower

Resources