grunt cannot find compass command. Why not? - javascript

I am trying to set up a node.js server on CentOS 7 using grunt and yeoman, but I am getting an error saying that the compass command cannot be found. I read this other posting about a similar error, but the other posting assumes you are using ruby on rails, which I am not. Also, the methods that I am testing come from this tutorial, and things stop working when I get to the point in the tutorial where it says to type grunt serve. I have made several additions to the tutorial to address error messages one by one, but the current error about compass does not seem to have a google-able answer.
What specific steps do I need to take to get grunt to be able to find and use compass?
Here is the current error which is causing grunt serve to fail:
Warning: Running "compass:server" (compass) task
Warning: Command failed: /bin/sh -c compass --version
/bin/sh: compass: command not found
Use --force to continue.
Aborted due to warnings.
Here is the series of commands leading up to this problem:
First, I performed the following installation commands as root:
yum install -y nodejs
yum clean all && yum update
yum install -y gcc-c++ openssl-devel make
npm install -g express
npm install -g express-generator
npm install -g yo
npm install -g generator-angular
npm install -g bower
npm install -g nodemon
npm install -g grunt-cli
npm install generator-karma
npm install -g compass
npm install -g grunt-contrib-compass
Next, I switched to a non-root user account and ran the following commands:
cd /home/user/angular_apps
mkdir /home/user/angular_apps/my_new_project && cd /home/user/angular_apps/my_new_project
mkdir /home/user/angular_apps/my_new_project/client // will house angular and app code
mkdir /home/user/angular_apps/my_new_project/server // will house node and express code, among other things
cd /home/user/angular_apps/my_new_project/client
yo angular // get yeoman to scaffold out the front end
// yeoman asked many questions. I said no to replacing grunt with anything else and I said yes to every other include
npm install // this will install all the required packages
bower install // this will hook up bower and thus prevent a downstream error
grunt serve
The grunt serve command results in the following complete error output:
[user#localhost client]$ grunt serve
Running "serve" task
Running "clean:server" (clean) task
>> 0 paths cleaned.
Running "wiredep:app" (wiredep) task
Running "wiredep:test" (wiredep) task
Running "wiredep:sass" (wiredep) task
Running "concurrent:server" (concurrent) task
Warning: Running "compass:server" (compass) task
Warning: Command failed: /bin/sh -c compass --version
/bin/sh: compass: command not found
Use --force to continue.
Aborted due to warnings.
Execution Time (2016-02-15 23:22:25 UTC)
loading tasks 254ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 76%
loading grunt-contrib-compass 28ms ▇▇▇ 8%
compass:server 50ms ▇▇▇▇▇ 15%
Total 333ms Use --force to continue.
Aborted due to warnings.
Execution Time (2016-02-15 23:22:24 UTC)
loading tasks 307ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 20%
wiredep:app 254ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 17%
wiredep:sass 37ms ▇▇▇ 2%
loading grunt-concurrent 23ms ▇▇ 2%
concurrent:server 865ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 57%
Total 1.5s
[user#localhost client]$
Note that the same error message is returned when I try running grunt serve as root instead. So what specific steps need to be taken to resolve this error?

I thought compass was a ruby thing.
try gem install compass
For yum based systems
yum -y install gcc ruby-devel rubygems compass might also work.

Related

How to resolve 'Unexpected end of JSON input' using typed-azure-functions?

I am using azure functions core tools from a cloned repository with a shopify microservice. The project setup has these steps:
npm install
npm run build
npm run typed-az-func -- push
npm run typed-az-func -- push --execute
npm run typed-az-func -- pull
I was logged in on azure using the azure-cli. In the last command (npm run typed-az-func -- pull), I've encountered some errors:
Command errors
I'm running Ubuntu 20.04.3 LTS
and installed Azure Function Core Tools from this: https://learn.microsoft.com/en-us/azure/azure-functions/functions-run-local?tabs=v3%2Clinux%2Ccsharp%2Cportal%2Cbash%2Ckeda
There's a high chance that your npm cache been damaged.
Try npm cache clean --force command before npm run command and this should resolve the issue.

GitLab CI with JS Linting

I have 0 experience with GitLab Continuous Integration and I need to setup a job to run ESLint on .js files.
I've already read the GitLab CI and Pipeline documentations, along with some Git Hooks, but I still have no idea how to setup this, so any detailed and starting from the very beginning answer is appreciated.
First you need to setup your CI and have some runners available so they can run your continuous integration jobs. The easiest way for this is to use gitlab-ci-multi-runner (project is here along with documentation) along with the docker executor that will run your CI jobs in docker containers. Once you have configured some runners, add them to your Gitlab project so they're available to run jobs.
Once that's taken care of, you need to add a .gitlab-ci.yml file to your project. This file is used to describe the jobs that need to run during continuous integration etc. Here is an example (assuming you install eslint using npm)
image: node:latest
stages:
- lint
eslint:
stage: lint
script:
# Install ESLint in this docker container
- npm install -g eslint
# Configure ESLint (will read your .eslintrc file)
- eslint --init
# Run ESLint
- eslint <your_js_file>
Add your .gitlab-ci.yml file, commit and push the changes. The CI pipeline should start and run the above steps.
If you'd like to have comments to your PRs here is an example with eslint and pronto. (we have ruby app so we check ruby code style too )
image: 'circleci/ruby:2.5.1-node-browsers'
codestyle:
script:
- sudo apt -y install cmake
# install eslint dependencies
- sudo npm install -g eslint
- sudo npm install -g eslint-plugin-babel
- sudo npm install -g eslint-plugin-react
- sudo npm install -g eslint-plugin-import
- sudo npm install -g babel-eslint
- sudo npm install -g eslint-config-airbnb
- sudo npm install -g eslint-plugin-jsx-a11y
# install pronto runners
- gem install pronto --no-ri
- gem install pronto-rubocop --no-ri
- gem install rubocop-rspec --no-ri
- gem install pronto-eslint_npm --no-ri
# run linters
- vendor/ruby/bin/pronto run -f gitlab -c origin/dev --exit-code
You can also run linters separately:
- vendor/ruby/bin/pronto run -r eslint_npm -f gitlab -c origin/dev --exit-code
This piece -f gitlab -c origin/dev tells linters to check only changed lines of code.
Also if you use pronto-eslint_npm and want to check files in specific folder add
.pronto_eslint_npm.yml that will contain needed regex. (in my case it has next line)
files_to_lint: app\/frontend\/\S*(\.js|\.es6|\.jsx)$

ENOTSUP warning

I am using a GitLab. For few part i need the Grunt's CLI.
I have installed Grunt globally by npm install -g grunt-cli.
Then I have install dependencies by npm install.
Now, Whenever I am trying to run the Grunt ($ grunt dev) I get the following warning.
ENOTSUP: operation not supported on socket, scandir 'G:\....\buildJs.json' Use --force to continue.
Aborted due to warnings.
How can i fix this problem?
Any help or suggestion would be very appreciated.

Grunt not being added to Environment Variables Path

I installed the Grunt cli with the following command?
npm install -g grunt-cli
Then I created the package.json and the Grunfile.js and run
npm install -S grunt
But grunt is not known by Windows. It says "´grunt´ is not recognized as an internal or external command".
Typing path on console, doesn't show Grunt, and where grunt also fails.
Did everything as Administrator on a Windows 8 machine.
What is wrong with this installation?
obs: and where is it installed?

Yeoman won´t scaffold backbone app

I'm using yeoman to scaffold a backbone app with the generator-backbone, however, everytime I run yo backbone, it ends up with this messages:
I'm all done. Running bower install for you to install the required dependencies. If this fails, try running the command yourself.
I'm all done. Running bower install & npm install for you to install the required dependencies. If this fails, try running the command yourself.
npm WARN package.json webdev#0.0.0 No description
npm WARN package.json webdev#0.0.0 No repository field.
npm WARN package.json webdev#0.0.0 No README data
And then, my directory is empty. There is no scaffold whatsoever.
The steps I took were this:
Create a directory: mkdir test
cd into test: cd test
run the generator: yo backbone
I don´t know what else to do, my directory always appears empty!
I tried to follow the same steps as you described but not able to reproduce the issue.
But you can try reinstalling generator-backbone.
npm cache clean
npm install -g generator-backbone#0.2.2
Please lemme know if you face the same issue after these steps.

Categories