Error message when globally installing brunch - node.js

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.

Related

Globally installed npm package not accessible in terminal

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

NodeJS module installers do not set PATH variable

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

zsh: command not found: grunt-init

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

npm install not installing things at /usr/bin

I am trying to install SailsJS with:
$ sudo npm install -g sails
It works, install everything at /home/brunoluiz/npm/lib/node_modules/sails with the following log:
/home/brunoluiz/npm/bin/sails -> /home/brunoluiz/npm/lib/node_modules/sails/bin/sails.js
sails#0.9.16 /home/brunoluiz/npm/lib/node_modules/sails
├── connect-flash#0.1.1
├── pluralize#0.0.5
├── inflection#1.2.5
├── grunt-sails-linker#0.9.5
├── grunt-contrib-clean#0.4.1
├── node-uuid#1.4.0
├── async#0.2.9
├── grunt-contrib-concat#0.3.0
├── grunt-contrib-copy#0.4.1
├── grunt-contrib-coffee#0.7.0
├── ejs-locals#1.0.2
├── ejs#0.8.4
├── underscore.string#2.3.0
├── coffee-script#1.6.2
├── lodash#2.4.1
├── i18n#0.4.1 (debug#0.8.0, sprintf#0.1.3)
├── optimist#0.3.4 (wordwrap#0.0.2)
├── include-all#0.1.2 (underscore.string#2.3.1)
├── sails-disk#0.9.3 (waterline-criteria#0.9.7, lodash#2.3.0, fs-extra#0.8.1)
├── fs-extra#0.5.0 (jsonfile#0.0.1, ncp#0.2.7, mkdirp#0.3.5, rimraf#2.1.4)
├── connect-redis#1.4.5 (debug#0.8.0, redis#0.7.3)
├── grunt-contrib-jst#0.5.0 (lodash#1.0.1, grunt-lib-contrib#0.5.3)
├── glob#3.1.14 (inherits#1.0.0, graceful-fs#1.1.14, minimatch#0.2.14)
├── grunt-contrib-cssmin#0.6.1 (grunt-lib-contrib#0.6.1, clean-css#1.0.12)
├── grunt-cli#0.1.9 (resolve#0.3.1, nopt#1.0.10, findup-sync#0.1.3)
├── grunt-contrib-watch#0.4.4 (gaze#0.3.4, tiny-lr#0.0.4)
├── connect-mongo#0.3.2 (mongodb#1.2.14)
├── grunt-contrib-uglify#0.2.2 (grunt-lib-contrib#0.6.1, uglify-js#2.3.6)
├── waterline#0.9.16 (underscore#1.5.2, q#0.9.7, anchor#0.9.12)
├── grunt#0.4.1 (which#1.0.5, dateformat#1.0.2-1.2.3, eventemitter2#0.4.13, colors#0.6.2, hooker#0.2.3, async#0.1.22, nopt#1.0.10, minimatch#0.2.14, lodash#0.9.2, rimraf#2.0.3, coffee-script#1.3.3, underscore.string#2.2.1, iconv-lite#0.2.11, glob#3.1.21, findup-sync#0.1.3, js-yaml#2.0.5)
├── winston#0.7.1 (cycle#1.0.3, stack-trace#0.0.9, eyes#0.1.8, colors#0.6.2, pkginfo#0.3.0, request#2.16.6)
├── express#3.4.0 (methods#0.0.1, debug#0.8.0, range-parser#0.0.4, cookie-signature#1.0.1, fresh#0.2.0, buffer-crc32#0.2.1, cookie#0.1.0, mkdirp#0.3.5, commander#1.2.0, send#0.1.4, connect#2.9.0)
├── grunt-contrib-less#0.9.0 (grunt-lib-contrib#0.6.1, chalk#0.4.0, less#1.6.3)
└── socket.io#0.9.14 (base64id#0.1.0, policyfile#0.0.4, redis#0.7.3, socket.io-client#0.9.11)
The problem is when you try to use sails: you run sails new project, for example, and it doesn't find sails. Investigating a little bit, I discovered npm is not installing the modules at /usr/bin. Is there some reason for that? Some config?
The same is happening with Karma module.
I used the nodejs from ppa, created the symbolic link for node and installed npm from the official install.sh script (https://www.npmjs.org/install.sh).
It sounds like your npm installation is configured to use /home/brunoluiz/npm as prefix, meaning that it will place symlinks to the CLIs that come with globally installed packages in {prefix}/bin.
In a default installation, prefix is either /usr or /usr/local on Unix platforms (%APPDATA%/npm on Windows).
If {prefix}/bin is not in your $PATH, you won't be able to execute such CLIs just by name.
To see the current prefix value in effect, run:
npm get prefix
Your options are:
Add /home/brunoluiz/npm/bin to your $PATH
Change the value of the prefix configuration item to a folder whose bin subfolder is already in your $PATH; e.g.:
npm set prefix /usr # Ubuntu; CLI symlinks are placed in /usr/bin
npm set prefix /usr/local # OSX; CLIs symlinks are placed in /usr/local/bin
Note, however, that you'd then have to reinstall your global packages for the symlinks to be created in the new {prefix}\bin location.
In addition to mklement0's answer, the first solution (adding the npm binary directory path to the PATH variable) creates another problem when the commands are run with sudo prefix on Linux environment. To solve it, the npm binary directory path must also be added in secure_path in /etc/sudoers.tmp. Here is how:
Why can't sudo find a command after I added it to PATH?

Command not found when trying to run a nodeschool lesson

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

Resources