Npm install do not install things in / usr / bin

I am trying to install SailsJS with:

$ sudo npm install -g sails

It works, installs everything in / 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 that you are trying to use sails: you launch sails new project, for example, and you will not find the sails. Having studied a little, I found that npm does not install modules in / usr / bin. Is there a reason for this? Some configuration?

The same thing happens with the Karma module.

I used nodejs from ppa, created a symbolic link for node and installed npm from the official install.sh script ( https://www.npmjs.org/install.sh ).

+4
1

, npm /home/brunoluiz/npm prefix, , CLI, {prefix}/bin.

prefix /usr, /usr/local Unix (%APPDATA%/npm Windows).

{prefix}/bin $PATH, CLI .

prefix, :

npm get prefix

:

  • /home/brunoluiz/npm/bin $PATH

  • prefix , bin $PATH; :.

    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

, , {prefix}\bin .

+11

Source: https://habr.com/ru/post/1536640/


All Articles