ember-cli / ember-cli.github.io

Our documentation site
13 stars 99 forks source link

Need sudo to create a new addon? #144

Closed myartsev closed 6 years ago

myartsev commented 7 years ago

Creating a new ember project works just fine: ember new foo
However, creating a new ember add-on fails due to permissions:

anijap@purpose:~/code$ ember addon bar
Error creating new application. Removing generated directory `./bar`
EACCES: permission denied, open '/usr/lib/node_modules/ember-cli/blueprints/addon/files/package.json'
Error: EACCES: permission denied, open '/usr/lib/node_modules/ember-cli/blueprints/addon/files/package.json'
    at Error (native)
    at Object.fs.openSync (fs.js:641:18)
    at Object.fs.writeFileSync (fs.js:1347:33)
    at Class._writeFileSync (/usr/lib/node_modules/ember-cli/blueprints/addon/index.js:173:8)
    at Class._writeContentsToFile (/usr/lib/node_modules/ember-cli/blueprints/addon/index.js:165:10)
    at Class.generatePackageJson (/usr/lib/node_modules/ember-cli/blueprints/addon/index.js:63:10)
    at Class.files (/usr/lib/node_modules/ember-cli/blueprints/addon/index.js:105:10)
    at Class.install (/usr/lib/node_modules/ember-cli/lib/models/blueprint.js:430:43)
    at _resolveBlueprint.then.blueprint (/usr/lib/node_modules/ember-cli/lib/tasks/install-blueprint.js:50:24)
    at tryCatch (/usr/lib/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:539:12)

A quick fix seems to be running the add-on generation with sudo, but that doesn't seem right. Why would you need root privileges?

The file in question, /usr/lib/node_modules/ember-cli/blueprints/addon/files/package.json, doesn't exist.

A little bit of research yields #https://github.com/ember-cli/ember-cli/issues/2438. The issue fits perfectly, but there is no satisfactory answer; the StackOverflow answer doesn't seem applicable, I have nothing related to node in /usr/local/lib,/usr/local/include or /usr/local/bin.

There is nothing unusual about my setup: latest version of debian and node.

Operating System: Debian GNU/Linux 8 (jessie)
Kernel: Linux 4.9.0-0.bpo.2-amd64
Architecture: x86-64
anijap@purpose:~$ ember -v
ember-cli: 2.13.1
node: 6.10.3
os: linux x64
mervinva commented 6 years ago

Same issue here . Got any solution ?

locks commented 6 years ago

Hi! I am closing this issue as this sounds like a problem with either an Ember CLI release, or with npm permissions in your system. Hopefully this has since been resolved.