Skip to content

Permission access error #696

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
omargon opened this issue May 9, 2016 · 21 comments
Closed

Permission access error #696

omargon opened this issue May 9, 2016 · 21 comments

Comments

@omargon
Copy link

omargon commented May 9, 2016

I am filing a bug.

  1. OS.Mac OSX (El Capitan)
  2. 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 <[email protected]>',
     'rodyhaddad <[email protected]>' ],
  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 <[email protected]> (http://rodyhaddad.com/)',
     'Igor Minar <[email protected]>' ],
  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: {} }

  1. 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 [email protected]: This package has been discontinued in favor of lodash@^4.0.0.
npm WARN deprecated [email protected]: 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
└── [email protected]

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
@Brocco
Copy link
Contributor

Brocco commented May 11, 2016

Take a look at this comment it should solve what you're seeing here.

@Brocco Brocco closed this as completed May 11, 2016
@omargon
Copy link
Author

omargon commented May 11, 2016

Thanks. That did the trick.

@JimLynchCodes
Copy link

JimLynchCodes commented Jul 17, 2016

The link in the answer takes me on a whole page linking redirect adventure. What did you guys actually do to fix this? thanks!

@JimLynchCodes
Copy link

Was that random npm video what helped you guys?

I was getting this error:

Error: EACCES: permission denied, open '/Users/jim/.config/configstore/ember-cli.json'
You don't have access to this file.

It seems like I fixed it by doing this:

sudo chown jim /Users/jim/.config/configstore/ember-cli.json

@n1alloc
Copy link

n1alloc commented Jul 20, 2016

@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 :)

@jUnG3
Copy link

jUnG3 commented Jul 22, 2016

@JimTheMan Thanks man that helped.

@jimbojw
Copy link

jimbojw commented Aug 2, 2016

The root cause of this issue (and many like it) is npm/write-file-atomic#11.

There is an outstanding patch which will fix this for everyone. We're all waiting for someone from npm to accept it: npm/write-file-atomic#13

@ricardoleme
Copy link

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}

@fredericabdou
Copy link

fredericabdou commented Oct 29, 2017

Hello Please Follow my simple guide to install angular 4 from the cli without any permission issues:

Install the angular-cli globally

sudo npm install -g @angular/cli

Create a new project and skip install

ng new my-app --skip-install

Serve the application and configure permissions

sudo chown <username> -R my-app
cd my-app
mkdir node_modules
chmod a+w node_modules
npm install
ng serve --open

@ghost
Copy link

ghost commented Nov 1, 2017

For me this worked

@TimUnderhay
Copy link

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>

@ASrima
Copy link

ASrima commented Jan 5, 2018

Run the IDE as Administrator to open the Angula folder and it will work as I had the same problem and running Visual Studio Code(You can use any type of your favorite IDE) as administrator solved the problem.

@kamensec
Copy link

Hi guys I was facing the same issue, my solution was using the following comment

I used sudo chown -R $USER /usr/local/ followed by npm install --unsafe-perm -g @angular/cli

@kharsha64
Copy link

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

@Jonah147
Copy link

npm install -g @angular/cli
npm ERR! git clone [email protected]:angular/cli Cloning into bare repository '/home/jonah/.npm/_git-remotes/git-jiasu.xzqcsaa.nyc.mn-angular-cli-515723dd'...
npm ERR! git clone [email protected]:angular/cli Permission denied (publickey).
npm ERR! git clone [email protected]:angular/cli fatal: Could not read from remote repository.
npm ERR! git clone [email protected]:angular/cli
npm ERR! git clone [email protected]:angular/cli Please make sure you have the correct access rights
npm ERR! git clone [email protected]:angular/cli and the repository exists.
npm ERR! addLocal Could not install angular/cli
npm ERR! Error: ENOENT: no such file or directory, stat 'angular/cli'
npm ERR! If you need help, you may report this entire log,
npm ERR! including the npm and node versions, at:
npm ERR! http://github.com/npm/npm/issues

npm ERR! System Linux 4.11.0-parrot6-amd64
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "--unsafe-perm" "-g" "@angular/cli"
npm ERR! cwd /home/jonah/.npm-global/lib
npm ERR! node -v v8.9.3
npm ERR! npm -v 1.4.21
npm ERR! path angular/cli
npm ERR! syscall stat
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/jonah/.npm-global/lib/npm-debug.log
npm ERR! not ok code 0

I've tried everything that's commented here what else should I try??

@mateusgalasso
Copy link

I solved like that
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}

sick

@umutesen
Copy link

I was trying to uninstall cli globally but did not realise I had an app running!

I stopped the app and it started working.

@livingWolf
Copy link

I just remove files '/usr/local/lib/@angular',and then run 'sudo npm install -g @angular/cli ' again.
It works.

@zuhairkareem
Copy link

zuhairkareem commented Aug 30, 2018

My npm config get prefix was /usr , so when I did
sudo 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.

@ghost
Copy link

ghost commented Jul 14, 2019

run 'sudo npm install -g @angular/cli working for me...!!
Thank you..

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.