I'm new to gruntjs and am trying to get the grunt-init templates up and running however I constantly get this error: zsh: command not found: grunt-init
when I run the install it shows me all of this, so it seems like it is installing fine
→ npm install -g grunt-init
/Users/jsturgess/npm-global/bin/grunt-init -> /Users/jsturgess/npm-global/lib/node_modules/grunt-init/bin/grunt-init
grunt-init#0.3.2 /Users/jsturgess/npm-global/lib/node_modules/grunt-init
├── semver#1.0.14
├── colors#0.6.2
├── async#0.2.10
├── hooker#0.2.3
├── lodash#2.4.1
├── prompt#0.1.12 (async#0.1.22, pkginfo#0.3.0, winston#0.5.11)
└── grunt#0.4.5 (which#1.0.9, dateformat#1.0.2-1.2.3, eventemitter2#0.4.14, getobject#0.1.0, rimraf#2.2.8, async#0.1.22, grunt-legacy-util#0.2.0, exit#0.1.2, nopt#1.0.10, lodash#0.9.2, coffee-script#1.3.3, underscore.string#2.2.1, glob#3.1.21, iconv-lite#0.2.11, grunt-legacy-log#0.1.1, js-yaml#2.0.5, minimatch#0.2.14, findup-sync#0.1.3)
I've followed the grunt-init install directions and made the ~/.grunt-init/ directory and cloned the jquery template via the command the gave
git clone https://github.com/gruntjs/grunt-init-jquery.git ~/.grunt-init/jquery
What do I need to do to be able to use the grunt-init command?
Seems like you are using OhMyZsh. You need to add the Grunt files to your $PATH variable.
cd into your home directory and find this file .zshrc and look for the line with
export PATH=
and modify it like:
export PATH="path_to_grunt:$PATH"
the ':' serves as a delimiter for multiple paths.
What you are probably looking for is here:
export PATH="/usr/local/lib/node_modules/grunt-cli/bin/grunt:$PATH"
Fixed this problem by undoing the npm permission changes I had done from this article: https://docs.npmjs.com/getting-started/fixing-npm-permissions
Related
I installed protractor through npm install -g protractor which run successfully.
Running npm -g ls --depth=0 shows protractor installed correctly.
azim#azim-desktop:~$ npm -g ls --depth=0
/home/azim/npm-global/lib
├── express-generator#4.13.1
├── generator-angular#0.12.1
├── generator-chrome-extension#0.3.1
├── generator-gulp-angular#1.0.2
├── generator-gulp-angular-subtask#0.9.1
├── generator-karma#1.0.0
├── generator-mocha#0.1.8
├── generator-react-webpack#3.2.2
├── git-remote-mango#0.0.2
├── jshint#2.7.0
├── jsx#0.9.89
├── mango-admin#0.1.1
├── n#2.1.0
├── npm#3.7.2
├── protractor#4.0.0
└── yo#1.6.0
but protractor isn't accessible in terminal.
azim#azim-desktop:~$ protractor
protractor: command not found
It was working fine a while ago, I've updated my npm and node to latest versions. I think after that the PATH variables messed up. Googled for a solution but didn't work anything. I don't want to mess up the current situation.
Current path is:
azim#azim-desktop:~$ echo $NODE_PATH
/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript:/home/azim/npm-global/lib/node_modules
Versions:
azim#azim-desktop:~$ npm --version
2.14.12
azim#azim-desktop:~$ node --version
v4.3.1
The environment variable $NODE_PATH is used by node to look for modules only.
Essentially you'll want to make sure that the directory path, where the protractor binary is located, is accessible through the environment variable $PATH instead.
Example of where my protractor is installed:
root#codeblog:~# which protractor /usr/bin/protractor
root#codeblog:~# env | grep PATH
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
NODE_PATH=/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript
If you got protractor installed at another place then you might want to tweak your ~/.bashrc to append that directory into the $PATH variable.
Like:
PATH=$PATH:/usr/my_protractor_dir/bin
For some reason on my current and previous pc, installing modules in NodeJS does not create PATH variables (Using windows 7/10). I managed to get the modules working in the past by manually editing my PATH variables, but it would be "cool" if NodeJS could do this for me...
I have just downloaded and installed NodeJS and Weinre again. npm gets added to the path variable, Weinre does not. (The same thing happend with Ionic a few weeks back, so had uninstalled it to try it again later).
I am running the command line prompt as an administrator.
Another thing which confuses me, which might be the cause of the problem is the following. I have installed NodeJS in:
C:\Program Files\nodejs"
But running "npm -g ls" gives me the following result:
C:\>npm -g ls
C:\Program Files\IBM\RAD9.1\cordova_cli
└─┬ weinre#2.0.0-pre-I0Z7U9OV
├─┬ express#2.5.11
│ ├─┬ connect#1.9.2
│ │ └── formidable#1.0.17
│ ├── mime#1.2.4
│ ├── mkdirp#0.3.0
│ └── qs#0.4.2
├─┬ nopt#3.0.4
│ └── abbrev#1.0.7
└── underscore#1.7.0
I have IBM Rational Application Developer installed, and it seems like NodeJS refers to this installation folder... :(
If the output of npm prefix -g matches C:\Program Files\IBM\RAD9.1\cordova_cli then everything is behaving as expected. You can either change your global npm prefix to your Node.js executable and reinstall the npm packages, or just add the current prefix to your PATH.
I would probably another clean reinstall of Node.js and npm. Before doing so, make sure to manually delete any existing npm modules and configs:
Run npm config ls -l, find the globalconfig line, and delete that file.
Go to the output directory of npm prefix -g and delete any node and node_modules files or directories.
Uninstall node as usual
Every time I try to install brunch by inputting "npm install -g brunch" in the command line, I get the following error message:
> fsevents#0.3.0 install /usr/local/share/npm/lib/node_modules/brunch/node_modules/chokidar/node_modules/fsevents
> node-gyp rebuild
CXX(target) Release/obj.target/fse/fsevents.o
In file included from ../fsevents.cc:86:
../src/constants.cc:10:66: warning: template argument uses unnamed type [-Wunnamed-type-template-args]
object->Set(NanNew<v8::String>("kFSEventStreamEventFlagNone"), NanNew<v8::Integer>(kFSEventStreamEvent...
^~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/FSEvents.h:290:1: note:
unnamed type used in template argument was declared here
enum {
^
1 warning generated.
SOLINK_MODULE(target) Release/fse.node
SOLINK_MODULE(target) Release/fse.node: Finished
/usr/local/share/npm/bin/brunch -> /usr/local/share/npm/lib/node_modules/brunch/bin/brunch
brunch#1.7.17 /usr/local/share/npm/lib/node_modules/brunch
├── debug#0.7.4
├── async-waterfall#0.1.5
├── async-each#0.1.4
├── commonjs-require-definition#0.1.2
├── commander#2.0.0
├── ncp#0.4.2
├── mkdirp#0.3.5
├── init-skeleton#0.2.4 (rimraf#2.2.8)
├── loggy#0.2.0 (growl#1.7.0, ansi-color#0.2.1, date-utils#1.2.16)
├── source-map#0.1.40 (amdefine#0.1.0)
├── coffee-script#1.8.0
├── anysort#0.2.0 (anymatch#0.2.0)
├── read-components#0.6.1 (component-builder#0.10.1)
├── pushserve#0.1.6 (connect-slashes#0.0.11, express#3.3.8)
└── chokidar#0.9.0 (recursive-readdir#0.0.2, fsevents#0.3.0)
I also have this printed when I do npm install -g brunch but it does get installed for me.
It also appears that it gets installed for you, because NPM prints dependency tree only when something is installed successfully.
Running brunch should give you
Usage: brunch [command] [options]
Commands:
new [skeleton] [path] Create new brunch project in path [.]. Short-cut: n
build [options] Build a brunch project. Short-cut: b
watch [options] Watch brunch directory and rebuild if something changed. Short-cut: w
Options:
-h, --help output usage information
-V, --version output the version number
now.
If it doesn't, either one is true:
Your shell doesn't know about the path to installed brunch binary;
I'm wrong and it didn't get installed for some reason.
In my case, brunch binary got installed as /usr/local/bin/brunch. It might be different for you because I'm using N. I strongly suggest you use it too to avoid any problems with permissions and to be able to switch Node versions.
You might want to try to set N up and try again with N—maybe the problem will go away and that'll be it.
I tried to install gulp by
npm install -g gulp
The output seems to be something like this. (i have skipped some logs)
npm http 304 https://registry.npmjs.org/string_decoder
npm http 304 https://registry.npmjs.org/lodash._htmlescapes
/usr/bin/gulp -> /usr/lib/node_modules/gulp/bin/gulp.js
gulp#3.6.2 /usr/lib/node_modules/gulp
├── tildify#0.2.0
├── pretty-hrtime#0.2.1
├── deprecated#0.0.1
├── archy#0.0.2
├── semver#2.2.1
├── chalk#0.4.0 (has-color#0.1.7, ansi-styles#1.0.0, strip-ansi#0.1.1)
├── orchestrator#0.3.3 (sequencify#0.0.7)
├── liftoff#0.9.8 (extend#1.2.1, minimist#0.0.8, resolve#0.6.3, findup-sync#0.1.3)
├── vinyl-fs#0.1.4 (graceful-fs#2.0.3, map-stream#0.1.0, mkdirp#0.3.5, vinyl#0.2.3, glob-stream#3.1.9, glob-watcher#0.0.6)
└── gulp-util#2.2.14 (lodash._reinterpolate#2.4.1, dateformat#1.0.7-1.2.3, minimist#0.0.8, vinyl#0.2.3, multipipe#0.0.2, through2#0.4.1, lodash.template#2.4.1)
In the above script i can see a line
/usr/bin/gulp -> /usr/lib/node_modules/gulp/bin/gulp.js
which i guess is making a simulink in bin folder. So i should be getting gulp globally but i get the this error.
No local gulp install found in /var/www/ksapp
Any idea why i am getting this error.
Thanks
As pointed out in the doc, you should install it globally (you did that) and add it to your project dev deps (locally):
npm install gulp --save-dev
I faced the same issue. Got it resolved by creating a link
npm link gulp
Check /home/username/.npm directory: maybe groups/owner of files is root. Change to username:
chown -R username.username /home/username/.npm
I've recently run into the "Local gulp not found" error message. I was able to work past it by creating a symlink from the global node_modules directory to the local project directory where my gulpfile.js is located.
I'm not sure if this is purposeful but when running the...
npm install learnyounode -g
..command in terminal, the module is being created in my home directory. When I try to run the 'learnyounode' command from the directory that I run the npm install from I get the message 'command not found'. I've looked in the usr directory but the learnyounode directory is not in there.
After everything intalls I get the following output
/Users/username/npm/bin/learnyounode -> /Users/username/npm/lib/node_modules/learnyounode/learnyounode.js
learnyounode#0.4.1 /Users/username/npm/lib/node_modules/learnyounode
├── duplexer#0.1.1
├── through#2.3.4
├── boganipsum#0.1.0
├── hyperquest#0.1.8 (through#2.2.7)
├── concat-stream#1.2.1 (bops#0.0.6)
├── bl#0.6.0 (readable-stream#1.0.26)
├── through2-map#1.2.1 (through2#0.2.3, terminus#1.0.9)
└── workshopper#0.7.2 (map-async#0.1.1, tuple-stream#0.0.2, split#0.2.10, mkdirp#0.3.5, xtend#2.1.2, colors-tmpl#0.1.0, terminal-menu#0.2.0, optimist#0.6.1, msee#0.1.1)
ps. I have a fresh install of node in my usr folder. I am more concerned that this problem is going to happen when I want to install other packages via NPM in the future.
I installed without the -g flag and it installed globally.
Trying to install learnyounode,
This path returns:
/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin