13

T hanks in advance for any help I can get.

I am trying to install packages like grunt, bower, and yeoman using nodejs and the NPM in my mac OSX 10.8's terminal.

I check node and NPM's versions to confirm they are installed correctly and have found that to be true. However when I begin to run a command to install a package like bower, using the following:

npm install -g bower

I get various amounts of errors coming up. I am trying to avoid using the sudo command. I tried using sudo, but afterwards I would get a response "command not found." I have a feeling the packages may not be in the correct folders or directories but I am unclear on what to do next.

For your reference these are the errors I get:

npm ERR! Error: EACCES, unlink '/Users/myname/.node/lib/node_modules/bower/.editorconfig'
npm ERR!  { [Error: EACCES, unlink '/Users/myname/.node/lib/node_modules/bower/.editorconfig']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/Users/myname/.node/lib/node_modules/bower/.editorconfig' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Darwin 12.5.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "bower"
npm ERR! cwd /Users/myname
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! path /Users/myname/.node/lib/node_modules/bower/.editorconfig
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, unlink '/Users/myname/.node/lib/node_modules/bower/.editorconfig'
npm ERR! error rolling back Error: EACCES, unlink '/Users/myname/.node/lib/node_modules/bower   /.editorconfig'
npm ERR! error rolling back  { [Error: EACCES, unlink '/Users/myname/.node/lib/node_modules/bower/.editorconfig']
npm ERR! error rolling back   errno: 3,
npm ERR! error rolling back   code: 'EACCES',
npm ERR! error rolling back   path: '/Users/myname/.node/lib/node_modules/bower/.editorconfig' }
npm ERR! not ok code 0

For privacy, I replaced my own name with the proxy myname in the paths. Moreover, this problem persists when I try installing grunt, and yeoman.

Upon further inspection, I noticed I have two folders. One named 'users' and one name 'usr.' Within 'users', I see a folder called node_modules. However, within 'usr/local/lib/node_modules/npm/node_modules' I noticed there is no bower, grunt, or yeoman files. This is just speculation, but are the files not properly installing into the necessary folders for them to be run in npm?

Any help or input would be extremely appreciated!

UPDATE 10/10/14

For people's reference, I have tried the sudo command to see if it would work, and it displays the following:

   /Users/myname/.node/bin/bower -> /Users/myname/.node/lib/node_modules/bower/bin/bower
     bower@1.3.12 /Users/myname/.node/lib/node_modules/bower
    ├── is-root@1.0.0
    ├── junk@1.0.0
    ├── stringify-object@1.0.0
    ├── abbrev@1.0.5
    ├── chmodr@0.1.0
    ├── which@1.0.5
    ├── osenv@0.1.0
    ├── opn@1.0.0
    ├── archy@0.0.2
    ├── rimraf@2.2.8
    ├── graceful-fs@3.0.3
    ├── bower-logger@0.2.2
    ├── lru-cache@2.5.0
    ├── bower-endpoint-parser@0.2.2
    ├── lockfile@1.0.0
    ├── nopt@3.0.1
    ├── retry@0.6.0
    ├── tmp@0.0.23
    ├── q@1.0.1
    ├── semver@2.3.2
    ├── p-throttler@0.1.0 (q@0.9.7)
    ├── request-progress@0.3.0 (throttleit@0.0.2)
    ├── bower-json@0.4.0 (intersect@0.0.3, deep-extend@0.2.11, graceful-fs@2.0.3)
    ├── fstream@1.0.2 (inherits@2.0.1)
    ├── shell-quote@1.4.2 (array-filter@0.0.1, array-reduce@0.0.0, array-map@0.0.0, jsonify@0.0.0)
    ├── mkdirp@0.5.0 (minimist@0.0.8)
    ├── promptly@0.2.0 (read@1.0.5)
    ├── fstream-ignore@1.0.1 (inherits@2.0.1, minimatch@1.0.0)
    ├── chalk@0.5.0 (escape-string-regexp@1.0.2, ansi-styles@1.1.0, supports-color@0.2.0, strip- ansi@0.3.0, has-ansi@0.1.0)
    ├── bower-config@0.5.2 (osenv@0.0.3, graceful-fs@2.0.3, optimist@0.6.1)
    ├── glob@4.0.6 (inherits@2.0.1, minimatch@1.0.0, once@1.3.1)
    ├── tar-fs@0.5.2 (pump@0.3.5, tar-stream@0.4.7)
    ├── decompress-zip@0.0.8 (nopt@2.2.1, mkpath@0.1.0, touch@0.0.2, readable-stream@1.1.13, binary@0.3.0)
    ├── request@2.42.0 (caseless@0.6.0, json-stringify-safe@5.0.0, aws-sign2@0.5.0, forever-agent@0.5.2, stringstream@0.0.4, oauth-sign@0.4.0, tunnel-agent@0.4.0, node-uuid@1.4.1, qs@1.2.2, mime-types@1.0.2, bl@0.9.3, form-data@0.1.4, tough-cookie@0.12.1, http-signature@0.10.0, hawk@1.1.1)
    ├── mout@0.9.1
    ├── cardinal@0.4.0 (redeyed@0.4.4)
    ├── bower-registry-client@0.2.1 (graceful-fs@2.0.3, request-replay@0.2.0, lru-cache@2.3.1, async@0.2.10, mkdirp@0.3.5, request@2.27.0)
    ├── update-notifier@0.2.0 (semver-diff@0.1.0, string-length@0.1.2, latest-version@0.2.0, configstore@0.3.1)
    ├── inquirer@0.7.1 (figures@1.3.3, mute-stream@0.0.4, through@2.3.6, readline2@0.1.0, lodash@2.4.1, rx@2.3.12, cli-color@0.3.2)
    ├── handlebars@2.0.0 (optimist@0.3.7, uglify-js@2.3.6)
    └── insight@0.4.3 (object-assign@1.0.0, async@0.9.0, chalk@0.5.1, os-name@1.0.1, lodash.debounce@2.4.1, tough-cookie@0.12.1, configstore@0.3.1, inquirer@0.6.0)

================================ However, the above is not a proper solution. When I try running a check to see if bower is installed like by typing bower -v or bower --version or any other bower command, I get "command not found." What is going on?

UPDATE 10/11/14

So nothing I have tried so far has given me the ability to run the command 'npm install -g bower.' Out of curiosity, as I have mentioned before, I have ran the 'sudo npm install -g bower command' which appeared to install bower. However, typing any bower commands still yields 'command not found.' Upon trying sudo bower commands leads to 'command not found' as well. What I do not understand though is that when I run the command 'npm ls' to look at what the NPM has installed, I interestingly have a list of the following installed packages. You do not need to read the list as it is long, but take note of how the first item appears to be bower. If this is true, and it means that bower was in fact installed by npm, why therefore, are bower commands not working?

    /Users/myname.
    ├─┬ bower@1.3.12
    │ ├── abbrev@1.0.5
    │ ├── archy@0.0.2
    │ ├─┬ bower-config@0.5.2
    │ │ ├── graceful-fs@2.0.3
    │ │ ├─┬ optimist@0.6.1
    │ │ │ ├── minimist@0.0.10
    │ │ │ └── wordwrap@0.0.2
    │ │ └── osenv@0.0.3
    │ ├── bower-endpoint-parser@0.2.2
    │ ├─┬ bower-json@0.4.0
    │ │ ├── deep-extend@0.2.11
    │ │ ├── graceful-fs@2.0.3
    │ │ └── intersect@0.0.3
    │ ├── bower-logger@0.2.2
    │ ├─┬ bower-registry-client@0.2.1
    │ │ ├── async@0.2.10
    │ │ ├── graceful-fs@2.0.3
    │ │ ├── lru-cache@2.3.1
    │ │ ├── mkdirp@0.3.5
    │ │ ├─┬ request@2.27.0
    │ │ │ ├── aws-sign@0.3.0
    │ │ │ ├── cookie-jar@0.3.0
    │ │ │ ├── forever-agent@0.5.2
    │ │ │ ├─┬ form-data@0.1.4
    │ │ │ │ ├── async@0.9.0
    │ │ │ │ └─┬ combined-stream@0.0.5
    │ │ │ │   └── delayed-stream@0.0.5
    │ │ │ ├─┬ hawk@1.0.0
    │ │ │ │ ├── boom@0.4.2
    │ │ │ │ ├── cryptiles@0.2.2
    │ │ │ │ ├── hoek@0.9.1
    │ │ │ │ └── sntp@0.2.4
    │ │ │ ├─┬ http-signature@0.10.0
    │ │ │ │ ├── asn1@0.1.11
    │ │ │ │ ├── assert-plus@0.1.2
    │ │ │ │ └── ctype@0.5.2
    │ │ │ ├── json-stringify-safe@5.0.0
    │ │ │ ├── mime@1.2.11
    │ │ │ ├── node-uuid@1.4.1
    │ │ │ ├── oauth-sign@0.3.0
    │ │ │ ├── qs@0.6.6
    │ │ │ └── tunnel-agent@0.3.0
    │ │ └── request-replay@0.2.0
    │ ├─┬ cardinal@0.4.0
    │ │ └─┬ redeyed@0.4.4
    │ │   └── esprima@1.0.4
    │ ├─┬ chalk@0.5.0
    │ │ ├── ansi-styles@1.1.0
    │ │ ├── escape-string-regexp@1.0.2
    │ │ ├─┬ has-ansi@0.1.0
    │ │ │ └── ansi-regex@0.2.1
    │ │ ├─┬ strip-ansi@0.3.0
    │ │ │ └── ansi-regex@0.2.1
    │ │ └── supports-color@0.2.0
    │ ├── chmodr@0.1.0
    │ ├─┬ decompress-zip@0.0.8
    │ │ ├─┬ binary@0.3.0
    │ │ │ ├── buffers@0.1.1
    │ │ │ └─┬ chainsaw@0.1.0
    │ │ │   └── traverse@0.3.9
    │ │ ├── mkpath@0.1.0
    │ │ ├── nopt@2.2.1
    │ │ ├─┬ readable-stream@1.1.13
    │ │ │ ├── core-util-is@1.0.1
    │ │ │ ├── inherits@2.0.1
    │ │ │ ├── isarray@0.0.1
    │ │ │ └── string_decoder@0.10.31
    │ │ └─┬ touch@0.0.2
    │ │   └── nopt@1.0.10
    │ ├─┬ fstream@1.0.2
    │ │ └── inherits@2.0.1
    │ ├─┬ fstream-ignore@1.0.1
    │ │ ├── inherits@2.0.1
    │ │ └─┬ minimatch@1.0.0
    │ │   └── sigmund@1.0.0
    │ ├─┬ glob@4.0.6
    │ │ ├── inherits@2.0.1
    │ │ ├─┬ minimatch@1.0.0
    │ │ │ └── sigmund@1.0.0
    │ │ └─┬ once@1.3.1
    │ │   └── wrappy@1.0.1
    │ ├── graceful-fs@3.0.3
    │ ├─┬ handlebars@2.0.0
    │ │ ├─┬ optimist@0.3.7
    │ │ │ └── wordwrap@0.0.2
    │ │ └─┬ uglify-js@2.3.6
    │ │   ├── async@0.2.10
    │ │   └─┬ source-map@0.1.40
    │ │     └── amdefine@0.1.0
    │ ├─┬ inquirer@0.7.1
    │ │ ├─┬ cli-color@0.3.2
    │ │ │ ├── d@0.1.1
    │ │ │ ├─┬ es5-ext@0.10.4
    │ │ │ │ ├── es6-iterator@0.1.1
    │ │ │ │ └── es6-symbol@0.1.1
    │ │ │ ├─┬ memoizee@0.3.8
    │ │ │ │ ├─┬ es6-weak-map@0.1.2
    │ │ │ │ │ ├── es6-iterator@0.1.1
    │ │ │ │ │ └── es6-symbol@0.1.1
    │ │ │ │ ├── event-emitter@0.3.1
    │ │ │ │ ├── lru-queue@0.1.0
    │ │ │ │ └── next-tick@0.2.2
    │ │ │ └─┬ timers-ext@0.1.0
    │ │ │   └── next-tick@0.2.2
    │ │ ├── figures@1.3.3
    │ │ ├── lodash@2.4.1
    │ │ ├── mute-stream@0.0.4
    │ │ ├─┬ readline2@0.1.0
    │ │ │ └─┬ chalk@0.4.0
    │ │ │   ├── ansi-styles@1.0.0
    │ │ │   ├── has-color@0.1.7
    │ │ │   └── strip-ansi@0.1.1
    │ │ ├── rx@2.3.12
    │ │ └── through@2.3.6
    │ ├─┬ insight@0.4.3
    │ │ ├── async@0.9.0
    │ │ ├─┬ chalk@0.5.1
    │ │ │ ├── ansi-styles@1.1.0
    │ │ │ ├── escape-string-regexp@1.0.2
    │ │ │ ├─┬ has-ansi@0.1.0
    │ │ │ │ └── ansi-regex@0.2.1
    │ │ │ ├─┬ strip-ansi@0.3.0
    │ │ │ │ └── ansi-regex@0.2.1
    │ │ │ └── supports-color@0.2.0
    │ │ ├─┬ configstore@0.3.1
    │ │ │ ├─┬ js-yaml@3.0.2
    │ │ │ │ ├─┬ argparse@0.1.15
    │ │ │ │ │ ├── underscore@1.4.4
    │ │ │ │ │ └── underscore.string@2.3.3
    │ │ │ │ └── esprima@1.0.4
    │ │ │ ├── object-assign@0.3.1
    │ │ │ └── uuid@1.4.2
    │ │ ├─┬ inquirer@0.6.0
    │ │ │ ├─┬ cli-color@0.3.2
    │ │ │ │ ├── d@0.1.1
    │ │ │ │ ├─┬ es5-ext@0.10.4
    │ │ │ │ │ ├── es6-iterator@0.1.1
    │ │ │ │ │ └── es6-symbol@0.1.1
    │ │ │ │ ├─┬ memoizee@0.3.8
    │ │ │ │ │ ├─┬ es6-weak-map@0.1.2
    │ │ │ │ │ │ ├── es6-iterator@0.1.1
    │ │ │ │ │ │ └── es6-symbol@0.1.1
    │ │ │ │ │ ├── event-emitter@0.3.1
    │ │ │ │ │ ├── lru-queue@0.1.0
    │ │ │ │ │ └── next-tick@0.2.2
    │ │ │ │ └─┬ timers-ext@0.1.0
    │ │ │ │   └── next-tick@0.2.2
    │ │ │ ├── lodash@2.4.1
    │ │ │ ├── mute-stream@0.0.4
    │ │ │ ├─┬ readline2@0.1.0
    │ │ │ │ └─┬ chalk@0.4.0
    │ │ │ │   ├── ansi-styles@1.0.0
    │ │ │ │   ├── has-color@0.1.7
    │ │ │ │   └── strip-ansi@0.1.1
    │ │ │ ├── rx@2.3.12
    │ │ │ └── through@2.3.6
    │ │ ├─┬ lodash.debounce@2.4.1
    │ │ │ ├── lodash.isfunction@2.4.1
    │ │ │ ├─┬ lodash.isobject@2.4.1
    │ │ │ │ └── lodash._objecttypes@2.4.1
    │ │ │ └─┬ lodash.now@2.4.1
    │ │ │   └── lodash._isnative@2.4.1
    │ │ ├── object-assign@1.0.0
    │ │ ├─┬ os-name@1.0.1
    │ │ │ ├── minimist@1.1.0
    │ │ │ └── osx-release@1.0.0
    │ │ └─┬ tough-cookie@0.12.1
    │ │   └── punycode@1.3.1
    │ ├── is-root@1.0.0
    │ ├── junk@1.0.0
    │ ├── lockfile@1.0.0
    │ ├── lru-cache@2.5.0
    │ ├─┬ mkdirp@0.5.0
    │ │ └── minimist@0.0.8
    │ ├── mout@0.9.1
    │ ├── nopt@3.0.1
    │ ├── opn@1.0.0
    │ ├── osenv@0.1.0
    │ ├─┬ p-throttler@0.1.0
    │ │ └── q@0.9.7
    │ ├─┬ promptly@0.2.0
    │ │ └─┬ read@1.0.5
    │ │   └── mute-stream@0.0.4
    │ ├── q@1.0.1
    │ ├─┬ request@2.42.0
    │ │ ├── aws-sign2@0.5.0
    │ │ ├─┬ bl@0.9.3
    │ │ │ └─┬ readable-stream@1.0.33-1
    │ │ │   ├── core-util-is@1.0.1
    │ │ │   ├── inherits@2.0.1
    │ │ │   ├── isarray@0.0.1
    │ │ │   └── string_decoder@0.10.31
    │ │ ├── caseless@0.6.0
    │ │ ├── forever-agent@0.5.2
    │ │ ├─┬ form-data@0.1.4
    │ │ │ ├── async@0.9.0
    │ │ │ ├─┬ combined-stream@0.0.5
    │ │ │ │ └── delayed-stream@0.0.5
    │ │ │ └── mime@1.2.11
    │ │ ├─┬ hawk@1.1.1
    │ │ │ ├── boom@0.4.2
    │ │ │ ├── cryptiles@0.2.2
    │ │ │ ├── hoek@0.9.1
    │ │ │ └── sntp@0.2.4
    │ │ ├─┬ http-signature@0.10.0
    │ │ │ ├── asn1@0.1.11
    │ │ │ ├── assert-plus@0.1.2
    │ │ │ └── ctype@0.5.2
    │ │ ├── json-stringify-safe@5.0.0
    │ │ ├── mime-types@1.0.2
    │ │ ├── node-uuid@1.4.1
    │ │ ├── oauth-sign@0.4.0
    │ │ ├── qs@1.2.2
    │ │ ├── stringstream@0.0.4
    │ │ ├─┬ tough-cookie@0.12.1
    │ │ │ └── punycode@1.3.1
    │ │ └── tunnel-agent@0.4.0
    │ ├─┬ request-progress@0.3.0
    │ │ └── throttleit@0.0.2
    │ ├── retry@0.6.0
    │ ├── rimraf@2.2.8
    │ ├── semver@2.3.2
    │ ├─┬ shell-quote@1.4.2
    │ │ ├── array-filter@0.0.1
    │ │ ├── array-map@0.0.0
    │ │ ├── array-reduce@0.0.0
    │ │ └── jsonify@0.0.0
    │ ├── stringify-object@1.0.0
    │ ├─┬ tar-fs@0.5.2
    │ │ ├─┬ pump@0.3.5
    │ │ │ ├─┬ end-of-stream@1.0.0
    │ │ │ │ └─┬ once@1.3.1
    │ │ │ │   └── wrappy@1.0.1
    │ │ │ └── once@1.2.0
    │ │ └─┬ tar-stream@0.4.7
    │ │   ├── bl@0.9.3
    │ │   ├─┬ end-of-stream@1.1.0
    │ │   │ └─┬ once@1.3.1
    │ │   │   └── wrappy@1.0.1
    │ │   ├─┬ readable-stream@1.0.33-1
    │ │   │ ├── core-util-is@1.0.1
    │ │   │ ├── inherits@2.0.1
    │ │   │ ├── isarray@0.0.1
    │ │   │ └── string_decoder@0.10.31
    │ │   └── xtend@4.0.0
    │ ├── tmp@0.0.23
    │ ├─┬ update-notifier@0.2.0
    │ │ ├─┬ configstore@0.3.1
    │ │ │ ├─┬ js-yaml@3.0.2
    │ │ │ │ ├─┬ argparse@0.1.15
    │ │ │ │ │ ├── underscore@1.4.4
    │ │ │ │ │ └── underscore.string@2.3.3
    │ │ │ │ └── esprima@1.0.4
    │ │ │ ├── object-assign@0.3.1
    │ │ │ └── uuid@1.4.2
    │ │ ├─┬ latest-version@0.2.0
    │ │ │ └─┬ package-json@0.2.0
    │ │ │   ├─┬ got@0.3.0
    │ │ │   │ └── object-assign@0.3.1
    │ │ │   └─┬ registry-url@0.1.1
    │ │ │     └─┬ npmconf@2.1.1
    │ │ │       ├─┬ config-chain@1.1.8
    │ │ │       │ └── proto-list@1.2.3
    │ │ │       ├── inherits@2.0.1
    │ │ │       ├── ini@1.3.0
    │ │ │       ├─┬ once@1.3.1
    │ │ │       │ └── wrappy@1.0.1
    │ │ │       └── uid-number@0.0.5
    │ │ ├── semver-diff@0.1.0
    │ │ └─┬ string-length@0.1.2
    │ │   └─┬ strip-ansi@0.2.2
    │ │     └── ansi-regex@0.1.0
    │ └── which@1.0.5
    ├─┬ easyimage@1.0.3
    │ └── q@1.0.1
    ├─┬ grunt@0.4.5
    │ ├── async@0.1.22
    │ ├── coffee-script@1.3.3
    │ ├── colors@0.6.2
    │ ├── dateformat@1.0.2-1.2.3
    │ ├── eventemitter2@0.4.14
    │ ├── exit@0.1.2
    │ ├─┬ findup-sync@0.1.3
    │ │ ├─┬ glob@3.2.11
    │ │ │ ├── inherits@2.0.1
    │ │ │ └─┬ minimatch@0.3.0
    │ │ │   ├── lru-cache@2.5.0
    │ │ │   └── sigmund@1.0.0
    │ │ └── lodash@2.4.1
    │ ├── getobject@0.1.0
    │ ├─┬ glob@3.1.21
    │ │ ├── graceful-fs@1.2.3
    │ │ └── inherits@1.0.0
    │ ├─┬ grunt-legacy-log@0.1.1
    │ │ ├── lodash@2.4.1
    │ │ └── underscore.string@2.3.3
    │ ├── grunt-legacy-util@0.2.0
    │ ├── hooker@0.2.3
    │ ├── iconv-lite@0.2.11
    │ ├─┬ js-yaml@2.0.5
    │ │ ├─┬ argparse@0.1.15
    │ │ │ ├── underscore@1.4.4
    │ │ │ └── underscore.string@2.3.3
    │ │ └── esprima@1.0.4
    │ ├── lodash@0.9.2
    │ ├─┬ minimatch@0.2.14
    │ │ ├── lru-cache@2.5.0
    │ │ └── sigmund@1.0.0
    │ ├─┬ nopt@1.0.10
    │ │ └── abbrev@1.0.5
    │ ├── rimraf@2.2.8
    │ ├── underscore.string@2.2.1
    │ └── which@1.0.5
    └─┬ grunt-bower-install@1.6.0
      ├─┬ bower-config@0.5.2
      │ ├── graceful-fs@2.0.3
      │ ├── mout@0.9.1
      │ ├─┬ optimist@0.6.1
      │ │ ├── minimist@0.0.10
      │ │ └── wordwrap@0.0.2
      │ └── osenv@0.0.3
      └─┬ wiredep@1.5.0
        ├─┬ chalk@0.1.1
        │ ├── ansi-styles@0.1.2
        │ └── has-color@0.1.7
        ├─┬ glob@3.2.11
        │ ├── inherits@2.0.1
        │ └─┬ minimatch@0.3.0
        │   ├── lru-cache@2.5.0
        │   └── sigmund@1.0.0
        ├── lodash@1.3.1
        └─┬ through2@0.4.2
          ├─┬ readable-stream@1.0.33-1
          │ ├── core-util-is@1.0.1
          │ ├── inherits@2.0.1
          │ ├── isarray@0.0.1
          │ └── string_decoder@0.10.31
          └─┬ xtend@2.1.2
            └── object-keys@0.4.0
user2793755
  • 131
  • 1
  • 1
  • 6
  • How did you install node? – srquinn Oct 10 '14 at 21:38
  • I went to nodejs' website. Downloaded the universal package for Mac which contained node v0.10.32pkg. Following the instructions from the package, I unlocked permissions to allow to install node since my security did not recognize the developer. Then I proceeded to install node as per the executable within the package. I agreed to the terms, then installed it on the default location the installer has already described, and then exited once it confirmed it installed node and npm. – user2793755 Oct 10 '14 at 22:58
  • At the end, I get the following summary 'Node was installed at /usr/local/bin/node npm was installed at /usr/local/bin/npm Make sure that /usr/local/bin is in your $PATH. – user2793755 Oct 10 '14 at 23:02
  • Assuming everything was correctly done, I went into terminal and typed npm install -g bower. And as already stated in my first post, I got the above results. – user2793755 Oct 10 '14 at 23:03
  • I was having a similar error when using npm install of bower on ubuntu while using ubuntu as guest os on a vm on a shared drive. Reason was symlink was not supported by ubuntu. I solved this by http://www.censore.blogspot.in/2015/04/npm-install-failing-with-erofs-in-npm.html – biplav Apr 07 '15 at 06:36

6 Answers6

6

This solved the problem for me:

sudo chown -R `whoami` ~/.node/lib/node_modules/bower/
npm install -g bower
bower -v
1.3.12

You shouldn't have to run npm install as sudo.

Per Quested Aronsson
  • 9,570
  • 8
  • 47
  • 70
6

This worked for me:

I basically gave my user permissions to the directory mentioned right after this -> stack Error: EACCES, unlink..., in your case it would be something like sudo chown -R USERNAME /Users/myname/.

For people who are new to this, don't forget to change USERNAME in the command above with your own, if you don't know your username, simply run whoami to get it.

After that you can install any package without the need to use sudo, npm install -g SomePackage.

user3731073
  • 77
  • 4
  • 9
4

Run the global (-g) installs as admin.

> sudo npm install -g bower

You got this error -

npm ERR! Please try running this command again as root/Administrator.

***** UPDATE BELOW *****

Check if it is installed and get the version

> bower -v

You might not be able to see bower now because it installed as admin. Try getting the version number by running

> sudo bower -v

You should see the version number now.

Take ownership of the package with chown

> cd /Users/<username>/.npm
> chown <username> bower*

I personally take ownership of everything in the /Users/ directory. It is your directory and not global.

> chown <username> *

***** UPDATE 2 BELOW *****

It looks like it's a PATH problem now. Do you see the npm directory in the PATH when you type

> echo $PATH

I use MacPorts so npm and node install in the /opt/local/bin and /opt/local/sbin directories. I did a quick check on the net and it looks like you need to have the following /usr/local/bin if you installed the package from the node site.

Check out this article about installing node (particularly the part about the PATH.

That link also references this article on how to modify your PATH.

Hope that helps.

VtoCorleone
  • 14,341
  • 4
  • 33
  • 48
  • I've read that using the sudo command is not recommended. Moreover, despite trying this method to see if it works I get what looks like the bower package installed. However, when I type in simple bower commands like bower -v or bower --version, I get "-bash: bower: command not found." – user2793755 Oct 11 '14 at 00:04
  • I just updated my answer. There's no way to get around using sudo to install globally. It makes sense because you are installing something everywhere... only admin should be able to do that. Taking ownership of your own user directory is perfectly safe. – VtoCorleone Oct 11 '14 at 00:16
  • Ah I see. However i tried sudo bower -v and still get bower command not found. – user2793755 Oct 11 '14 at 00:21
  • I think it's a PATH issue. I just updated the answer again. If that doesn't work, I might be out of ideas. Good luck and mark correct if it worked :) – VtoCorleone Oct 11 '14 at 14:36
  • Hey VtoCorleone, I have a feeling it's a path issue as well. I'll report back if your proposed solution works. Thanks for all your input in so far. – user2793755 Oct 12 '14 at 00:03
  • So I tried the instructions as listed in your links. I went into my terminal and cd'ed into my home directory. Following that, I ran the command ' nano .bash_profile and added the following:export PATH="/usr/local/bin:$PATH". I saved and then exited nano and checked using echo $PATH again only to see the same result as before. I made sure I saved and followed the instructions to a T. – user2793755 Oct 12 '14 at 02:16
  • For reference as well, as the beginning of the tutorial stated to run mysql as the first thing to type, I typed 'npm' and then echo $PATH and did not get the expected result "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin" as predicted by the tutorial. – user2793755 Oct 12 '14 at 02:18
3

I was having similar issues when trying to install bower through NPM.

I am not an expert on this but was sure it was connected to $PATH and found 2 articles which in combination fixed this for me perfectly.

The first is this gist by Dan Haerbert: https://gist.github.com/DanHerbert/9520689

Dan says

"If you're a Mac Homebrew user and you installed node via Homebrew, there is a major philosophical issue with the way Homebrew and NPM work together. If you install node with Homebrew and then try to do npm update npm -g, you will see an error like this:"

The error he shows is very similar to your original error.

His solution is to re-install node but to make sure that NPM is not installed via homebrew since, as he says:

npm is its own package manager and it is therefore better to have npm manage itself and its packages instead of letting Homebrew do it. Also, using the Homebrew version of npm requires sudo to install global packages. That's also a very bad idea.

He says to uninstall node and then re-install it with the following commands:

brew install node --without-npm
echo prefix=~/.node >> ~/.npmrc
curl -L https://www.npmjs.org/install.sh | sh

And then to finish up with

export PATH="$HOME/.node/bin:$PATH"

This worked for me and fixed all my issues. I was able to run 'npm install -g bower' without getting the error message.

Finally, before I did the steps above, I wanted to make sure that I had fully uninstalled node & npm. To do that, I followed the following steps from stackoverflow question 11177954, specifically from the answer by Dominic Tancredi, who says:

To recap, the best way (I've found) to completely uninstall node + npm is to do the following:

  1. go to /usr/local/lib and delete any node and node_modules
  2. go to /usr/local/include and delete any node and node_modules directory
  3. if you installed with brew install node, then run brew uninstall node in your terminal
  4. check your Home directory for any local or lib or include folders, and delete any node or node_modules from there
  5. go to /usr/local/bin and delete any node executable You may need to do the additional instructions as well:
sudo rm /usr/local/bin/npm
sudo rm /usr/local/share/man/man1/node.1
sudo rm /usr/local/lib/dtrace/node.d
sudo rm -rf ~/.npm
sudo rm -rf ~/.node-gyp
sudo rm /opt/local/bin/node
sudo rm /opt/local/include/node
sudo rm -rf /opt/local/lib/node_modules

I hope that is of help to someone :-)

Community
  • 1
  • 1
Jonathan Garner
  • 206
  • 3
  • 11
1

I had a similar issue with my mac. I did the followings to solve the problem.

  1. open 'Disk Utility' application
  2. select your hard drive.
  3. run verify disk permissions
  4. run repair disk permissions
ywplee
  • 31
  • 1
  • 5
  • Do you mind explaining what that does specifically? I'll try it and report back on my progress. – user2793755 Oct 11 '14 at 00:19
  • Just tried this method, and despite it all, I am still getting the originally mentioned errors. – user2793755 Oct 11 '14 at 00:36
  • Usually, when I get that error, it was related to the permission issue with the folder where npm is trying to install the package. If this didn't fix your problem, you can try to run chown recursively on /Users/myname/.node folder. – ywplee Oct 11 '14 at 01:24
0

you need to chmod and change the file permission for all the files inside /Users//.config/configstore/

should work fine after that. Mac users may have to switch to root using su which they have to enable from system preferences before running chmod command.