curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install nodejs
sudo apt-get install build-essential
sudo npm install --save-dev --global bower
cd Рабочий\ стол/
sudo mkdir bower-test
cd bower-test
sudo bower init
bower ESUDO Cannot be run with sudo
Additional error details:
Since bower is a user command, there is no need to execute it with superuser permissions.
If you're having permission errors when using bower without sudo, please spend a few minutes learning more about how your system should work and make any necessary repairs.
www.joyent.com/blog/installing-node-and-npm
https://gist.github.com/isaacs/579814
You can however run a command with sudo using --allow-root option
bower init
Error: EACCES, permission denied '/home/ivan/.config/configstore/bower-github.yml'
You don't have access to this file.
at Object.fs.openSync (evalmachine.:439:18)
at Object.fs.readFileSync (evalmachine.:290:15)
at Object.create.all.get (/usr/lib/node_modules/bower/node_modules/configstore/index.js:34:29)
at Object.Configstore (/usr/lib/node_modules/bower/node_modules/configstore/index.js:27:44)
at readCachedConfig (/usr/lib/node_modules/bower/lib/config.js:19:23)
at defaultConfig (/usr/lib/node_modules/bower/lib/config.js:11:12)
at Object. (/usr/lib/node_modules/bower/lib/index.js:40:32)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
В чем проблема
Error: EACCES, permission denied '/home/ivan/.config/configstore/bower-github.yml'
You don't have access to this file.
как её исправит?bower.io/#install-bower
ivan@pc:~$ npm -v
1.4.28
ivan@pc:~$ npm install --global bower
npm ERR! Error: EACCES, unlink '/usr/bin/bower'
npm ERR! { [Error: EACCES, unlink '/usr/bin/bower'] errno: 3, code: 'EACCES', path: '/usr/bin/bower' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Linux 3.19.0-33-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "--global" "bower"
npm ERR! cwd /home/ivan
npm ERR! node -v v0.10.40
npm ERR! npm -v 1.4.28
npm ERR! path /usr/bin/bower
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, unlink '/usr/bin/bower'
npm ERR! error rolling back Error: EACCES, unlink '/usr/bin/bower'
npm ERR! error rolling back { [Error: EACCES, unlink '/usr/bin/bower'] errno: 3, code: 'EACCES', path: '/usr/bin/bower' }
npm ERR! not ok code 0
ivan@pc:~$
ivan@pc:~$ npm -v
1.4.28
ivan@pc:~$ npm install --global bower
npm ERR! Error: EACCES, unlink '/usr/bin/bower'
npm ERR! { [Error: EACCES, unlink '/usr/bin/bower'] errno: 3, code: 'EACCES', path: '/usr/bin/bower' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Linux 3.19.0-33-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "--global" "bower"
npm ERR! cwd /home/ivan
npm ERR! node -v v0.10.40
npm ERR! npm -v 1.4.28
npm ERR! path /usr/bin/bower
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, unlink '/usr/bin/bower'
npm ERR! error rolling back Error: EACCES, unlink '/usr/bin/bower'
npm ERR! error rolling back { [Error: EACCES, unlink '/usr/bin/bower'] errno: 3, code: 'EACCES', path: '/usr/bin/bower' }
npm ERR! not ok code 0
ivan@pc:~$ bower -v
Error: EACCES, permission denied '/home/ivan/.config/configstore/bower-github.yml'
You don't have access to this file.
at Object.fs.openSync (evalmachine.<anonymous>:439:18)
at Object.fs.readFileSync (evalmachine.<anonymous>:290:15)
at Object.create.all.get (/usr/lib/node_modules/bower/node_modules/configstore/index.js:34:29)
at Object.Configstore (/usr/lib/node_modules/bower/node_modules/configstore/index.js:27:44)
at readCachedConfig (/usr/lib/node_modules/bower/lib/config.js:19:23)
at defaultConfig (/usr/lib/node_modules/bower/lib/config.js:11:12)
at Object.<anonymous> (/usr/lib/node_modules/bower/lib/index.js:40:32)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
ivan@pc:~$ sudo bower -v
[sudo] password for ivan:
1.6.5
ivan@pc:~$ sudo npm remove --dave-dev --global bower
unbuild bower@1.6.5
ivan@pc:~$ sudo bower -v
sudo: bower: command not found
ivan@pc:~$ npm install -g bower
npm ERR! Error: EACCES, mkdir '/usr/lib/node_modules/bower'
npm ERR! { [Error: EACCES, mkdir '/usr/lib/node_modules/bower']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/lib/node_modules/bower',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/lib/node_modules/bower',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack:
npm ERR! [ '/usr/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23',
npm ERR! '/usr/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53',
npm ERR! 'Object.oncomplete (fs.js:108:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Linux 3.19.0-33-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "bower"
npm ERR! cwd /home/ivan
npm ERR! node -v v0.10.40
npm ERR! npm -v 1.4.28
npm ERR! path /usr/lib/node_modules/bower
npm ERR! fstream_path /usr/lib/node_modules/bower
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/usr/lib/node_modules/bower'
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53
npm ERR! fstream_stack Object.oncomplete (fs.js:108:15)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/ivan/npm-debug.log
npm ERR! not ok code 0
ivan@pc:~$ sudo bower -v
sudo: bower: command not found
ivan@pc:~$ bower -v
bash: /usr/bin/bower: Нет такого файла или каталога
ivan@pc:~$
ivan@pc:~$ sudo bower -v
sudo: bower: command not found
ivan@pc:~$ bower -v
bash: /usr/bin/bower: Нет такого файла или каталога
ivan@pc:~$ npm -v
1.4.28
ivan@pc:~$ npm install -g bower
npm ERR! Error: EACCES, mkdir '/usr/lib/node_modules/bower'
npm ERR! { [Error: EACCES, mkdir '/usr/lib/node_modules/bower']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/lib/node_modules/bower',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/lib/node_modules/bower',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack:
npm ERR! [ '/usr/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23',
npm ERR! '/usr/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53',
npm ERR! 'Object.oncomplete (fs.js:108:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Linux 3.19.0-33-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "bower"
npm ERR! cwd /home/ivan
npm ERR! node -v v0.10.40
npm ERR! npm -v 1.4.28
npm ERR! path /usr/lib/node_modules/bower
npm ERR! fstream_path /usr/lib/node_modules/bower
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/usr/lib/node_modules/bower'
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53
npm ERR! fstream_stack Object.oncomplete (fs.js:108:15)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/ivan/npm-debug.log
npm ERR! not ok code 0
ivan@pc:~$
. ~/.bachrc
, чтобы путь поиска применился. Потом можно и npm локально ставить с помощью npm install -g npm
и node туда же с https://www.npmjs.com/package/n или https://www.npmjs.com/package/nvm ivan@pc:~$ npm i bower
bower@1.6.5 node_modules/bower
ivan@pc:~$ bower -v
bower: команда не найдена
ivan@pc:~$
curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install nodejs
sudo apt-get install build-essential
ivan@pc:~$ npm config list
; cli configs
registry = "https://registry.npmjs.org/"
user-agent = "npm/1.4.28 node/v0.10.40 linux x64"
; userconfig /home/ivan/.npmrc
prefix = "/home/ivan/.local"
; node bin location = /usr/bin/node
; cwd = /home/ivan
; HOME = /home/ivan
; 'npm config ls -l' to show all defaults.
ivan@pc:~$
ivan@pc:~$ echo $PATH
/home/ivan/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
ivan@pc:~$
ivan@pc:~$ npm remove bower
unbuild bower@1.6.5
ivan@pc:~$ npm i -g bower
/home/ivan/.local/bin/bower -> /home/ivan/.local/lib/node_modules/bower/bin/bower
bower@1.6.5 /home/ivan/.local/lib/node_modules/bower
ivan@pc:~$ bower -v
Error: EACCES, permission denied '/home/ivan/.config/configstore/bower-github.yml'
You don't have access to this file.
at Object.fs.openSync (evalmachine.<anonymous>:439:18)
at Object.fs.readFileSync (evalmachine.<anonymous>:290:15)
at Object.create.all.get (/home/ivan/.local/lib/node_modules/bower/node_modules/configstore/index.js:34:29)
at Object.Configstore (/home/ivan/.local/lib/node_modules/bower/node_modules/configstore/index.js:27:44)
at readCachedConfig (/home/ivan/.local/lib/node_modules/bower/lib/config.js:19:23)
at defaultConfig (/home/ivan/.local/lib/node_modules/bower/lib/config.js:11:12)
at Object.<anonymous> (/home/ivan/.local/lib/node_modules/bower/lib/index.js:40:32)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
ivan@pc:~$
npm config set prefix ~/.local
export PATH=~/.local/bin:$PATH
$ npm i -g n
$ echo export N_PREFIX=~/.local >> ~/.bashrc
$ . ~/.bashrc
$ n 4.0
$ node -v
ivan@pc:~$ npm i -g n
/home/ivan/.local/bin/n -> /home/ivan/.local/lib/node_modules/n/bin/n
n@2.0.2 /home/ivan/.local/lib/node_modules/n
ivan@pc:~$ echo export N_PREFIX=~/.local >> ~/.bashrc
ivan@pc:~$ . ~/.bashrc
ivan@pc:~$ n 4.0
/usr/bin/env: bash: Нет такого файла или каталога
ivan@pc:~$ n 4.2.2
/usr/bin/env: bash: Нет такого файла или каталога
ivan@pc:~$ node -v
Команда 'node' доступна в '/usr/bin/node'
Команда не может быть найдена, потому что '/usr/bin' не включена в переменную окружения PATH
node: команда не найдена
ivan@pc:~$
export PATH=~/.local/bin:$PATHexport N_PREFIX=/home/ivan/.local
export PATH=~/.local/bin:$PATH
export N_PREFIX=/home/ivan/.local
ivan@pc:~$ n 4.2.2
install : node-v4.2.2
mkdir : /home/ivan/.local/n/versions/node/4.2.2
fetch : https://nodejs.org/dist/v4.2.2/node-v4.2.2-linux-x64.tar.gz
installed : v4.2.2
ivan@pc:~$ node -v
v0.10.40
ivan@pc:~$