angular-cli: Permission access error
I am filing a bug.
- OS.Mac OSX (El Capitan)
- Versions. Please run
ng --version
. If there’s nothing outputted, please run in a Terminal:node --version
v4.4.2
npm --version
3.8.6
npm info angular-cli
{ name: 'angular-cli',
time:
{ modified: '2016-05-07T16:07:33.383Z',
created: '2014-10-07T04:34:38.078Z',
'1.0.0': '2014-10-07T04:34:38.078Z',
'0.0.0': '2014-10-11T11:38:24.914Z',
'0.0.1': '2015-08-03T17:12:04.553Z',
'0.0.2': '2015-10-18T17:46:40.146Z',
'0.0.3': '2015-10-18T21:42:52.445Z',
'0.0.4': '2015-10-19T01:14:13.216Z',
'0.0.5': '2015-10-19T09:14:01.712Z',
'0.0.6': '2015-10-19T09:36:51.644Z',
'0.0.7': '2015-10-19T11:48:24.233Z',
'0.0.8': '2015-10-19T11:51:59.318Z',
'0.0.9': '2015-10-19T21:18:13.725Z',
'0.0.10': '2015-10-19T22:18:13.091Z',
'0.0.11': '2015-11-03T05:03:06.345Z',
'0.0.12': '2015-11-15T10:10:48.551Z',
'0.0.13': '2015-12-04T17:16:43.662Z',
'0.0.14': '2015-12-05T01:40:39.377Z',
'0.0.15': '2015-12-05T05:50:59.226Z',
'0.0.16': '2015-12-10T12:23:28.722Z',
'0.0.17': '2015-12-14T19:37:08.400Z',
'0.0.18': '2015-12-15T12:51:47.990Z',
'0.0.19': '2015-12-15T18:23:33.077Z',
'0.0.20': '2015-12-15T20:39:55.357Z',
'0.0.22': '2016-02-20T00:36:56.908Z',
'0.0.23': '2016-02-20T01:44:13.897Z',
'0.0.24': '2016-02-25T17:41:20.619Z',
'0.0.25': '2016-03-10T02:10:05.410Z',
'0.0.26': '2016-03-23T00:39:46.402Z',
'0.0.27': '2016-03-23T22:05:56.538Z',
'0.0.28': '2016-03-28T22:39:45.766Z',
'0.0.29': '2016-03-30T18:10:47.060Z',
'0.0.30': '2016-04-06T22:27:32.015Z',
'0.0.31': '2016-04-11T18:20:32.677Z',
'0.0.33': '2016-04-19T22:31:48.209Z',
'0.0.34': '2016-04-26T17:56:20.524Z',
'0.0.37': '2016-05-03T18:49:21.731Z',
'0.0.39': '2016-05-04T16:29:23.054Z',
'0.1.0': '2016-05-05T19:41:05.830Z',
'1.0.0-beta.0': '2016-05-06T18:18:54.950Z',
'1.0.0-beta.1': '2016-05-07T16:07:33.383Z' },
maintainers:
[ 'angularcore <angular-core+npm@google.com>',
'rodyhaddad <npm@rodyhaddad.com>' ],
description: 'CLI tool for Angular',
versions:
[ '0.0.0',
'0.0.1',
'0.0.2',
'0.0.3',
'0.0.4',
'0.0.5',
'0.0.6',
'0.0.7',
'0.0.8',
'0.0.9',
'0.0.10',
'0.0.11',
'0.0.12',
'0.0.13',
'0.0.14',
'0.0.15',
'0.0.16',
'0.0.17',
'0.0.18',
'0.0.19',
'0.0.20',
'0.0.22',
'0.0.23',
'0.0.24',
'0.0.25',
'0.0.26',
'0.0.27',
'0.0.28',
'0.0.29',
'0.0.30',
'0.0.31',
'0.0.33',
'0.0.34',
'0.0.37',
'0.0.39',
'0.1.0',
'1.0.0-beta.0',
'1.0.0-beta.1' ],
'dist-tags': { latest: '1.0.0-beta.1', beta: '1.0.0-beta.1' },
readmeFilename: 'README.md',
homepage: 'https://github.com/angular/angular-cli',
keywords: [],
repository:
{ type: 'git',
url: 'git+https://github.com/angular/angular-cli.git' },
author: 'Angular Authors',
bugs: { url: 'https://github.com/angular/angular-cli/issues' },
license: 'MIT',
contributors:
[ 'Rody Haddad <npm@rodyhaddad.com> (http://rodyhaddad.com/)',
'Igor Minar <igor@angularjs.org>' ],
users: { altrim: true, seachange: true },
version: '1.0.0-beta.1',
main: 'lib/cli/index.js',
trackingCode: 'UA-8594346-19',
bin: { ng: './bin/ng' },
scripts: { test: 'node tests/runner', lint: 'eslint .' },
engines: { node: '>= 4.1.0' },
dependencies:
{ broccoli: '^1.0.0-beta.7',
'broccoli-caching-writer': '^2.2.1',
'broccoli-concat': '^2.2.0',
'broccoli-funnel': '^1.0.1',
'broccoli-merge-trees': '^1.1.1',
'broccoli-source': '^1.1.0',
'broccoli-writer': '^0.1.1',
chalk: '^1.1.3',
'ember-cli': '2.5.0',
'ember-cli-string-utils': '^1.0.0',
exit: '^0.1.2',
'fs-extra': '^0.30.0',
glob: '^7.0.3',
leek: '0.0.21',
lodash: '^4.11.1',
opn: '4.0.1',
resolve: '^1.1.7',
shelljs: '^0.7.0',
'silent-error': '^1.0.0',
'symlink-or-copy': '^1.0.3',
'systemjs-builder': '^0.15.16',
typescript: '^1.8.10',
typings: '^0.8.1' },
'ember-addon': { paths: [ './addon/ng2/' ] },
devDependencies:
{ chai: '^3.5.0',
'clang-format': '^1.0.38',
eslint: '^2.8.0',
'exists-sync': '0.0.3',
minimatch: '^3.0.0',
mocha: '^2.4.5',
'mock-fs': '^3.8.0',
'object-assign': '^4.0.1',
rewire: '^2.5.1',
sinon: '^1.17.3',
through: '^2.3.8',
tslint: '^3.8.1',
'walk-sync': '^0.2.6' },
gitHead: '668ecee86bc9acbf5fc41994802eb263b8b9c4aa',
dist:
{ shasum: '86feceee719d7a14579ab4486ca3077a1a80a840',
tarball: 'https://registry.npmjs.org/angular-cli/-/angular-cli-1.0.0-beta.1.tgz' },
directories: {} }
- Repro steps.
While trying to install the latest version of angular-cli I get the following errors after attempting to run:
npm install -g angular-cli
I get:
npm WARN deprecated lodash-node@2.4.1: This package has been discontinued in favor of lodash@^4.0.0.
npm WARN deprecated graceful-fs@3.0.8: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/angular-cli
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
/usr/local/lib
└── angular-cli@1.0.0-beta.1
npm ERR! Darwin 15.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "angular-cli"
npm ERR! node v4.4.2
npm ERR! npm v3.8.6
npm ERR! path /usr/local/lib/node_modules/angular-cli
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/angular-cli'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules/angular-cli']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules/angular-cli' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/omar/.config/configstore/npm-debug.log
I tried running the install as sudo, but then when I try running an ng command i get the following error:
ng new my-project
/usr/local/lib/node_modules/angular-cli/node_modules/configstore/index.js:54
throw err;
^
Error: EACCES: permission denied, open '/Users/omar/.config/configstore/ember-cli.json'
You don't have access to this file.
at Error (native)
at Object.fs.openSync (fs.js:549:18)
at Object.fs.readFileSync (fs.js:397:15)
at Object.create.all.get (/usr/local/lib/node_modules/angular-cli/node_modules/configstore/index.js:35:26)
at Object.Configstore (/usr/local/lib/node_modules/angular-cli/node_modules/configstore/index.js:28:44)
at clientId (/usr/local/lib/node_modules/angular-cli/node_modules/ember-cli/lib/cli/index.js:22:21)
at module.exports (/usr/local/lib/node_modules/angular-cli/node_modules/ember-cli/lib/cli/index.js:65:19)
at module.exports (/usr/local/lib/node_modules/angular-cli/lib/cli/index.js:102:10)
at /usr/local/lib/node_modules/angular-cli/bin/ng:31:5
at /usr/local/lib/node_modules/angular-cli/node_modules/resolve/lib/async.js:46:14
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 21 (1 by maintainers)
Change the owner of npm’s directories to the name of the current user
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
Take a look at this comment it should solve what you’re seeing here.
Hello Please Follow my simple guide to install angular 4 from the cli without any permission issues:
Install the angular-cli globally
Create a new project and skip install
Serve the application and configure permissions
Just got a bit of insight - I was running into the same issue with High Sierra. The problem is a script which gets executed by sass during the @angular/cli install, which even if you install with sudo, this script executes as user ‘nobody’. This can be worked around with:
npm install --unsafe-perm -g @angular/cli@<version>
Was that random npm video what helped you guys?
I was getting this error:
It seems like I fixed it by doing this:
I solved like that sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
sick
Thanks. That did the trick.
My
npm config get prefix
was/usr
, so when I didsudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
as suggested in some comments above, it changed the ownership of/usr/bin/sudo
as well. That messes up all sudo commands, so I had to goto recovery mode in Ubuntu to set it back to root again.Check the
npm config get prefix
directory before doing it. Don’t change ownership if it is/usr
.Thanks @citizentim Your solution worked.
I didn’t provide version in the command and the installer automatically picked the latest version to install.
npm install --unsafe-perm -g @angular/cli
Hi guys I was facing the same issue, my solution was using the following comment
I used
sudo chown -R $USER /usr/local/
followed bynpm install --unsafe-perm -g @angular/cli
@JimTheMan Thanks man that helped.
@JimTheMan Thanks! Was having the same issue with ng2’s CLI and the previous comment’s solution wasn’t working. Finally, can enjoy using the CLI 😃