Preact-cli: Install access issues

Created on 21 Jul 2020  路  4Comments  路  Source: preactjs/preact-cli

I sign-in as admin and and use the command sudo npm install -g preact-cli@rc and there's an error. The install is on arch with the latest versions of node and npm. Other than that, are there are other react command line tools or frameworks that implement babel (etc) like that tool?

The error is:

Error: EACCES: permission denied, open '/usr/lib/node_modules/preact-cli/node_modules/nodent-runtime/dist/index.js'
    at Object.openSync (fs.js:465:3)
    at Object.writeFileSync (fs.js:1416:35)
    at Module._compile (internal/modules/cjs/loader.js:1201:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1221:10)
    at Module.load (internal/modules/cjs/loader.js:1050:32)
    at Function.Module._load (internal/modules/cjs/loader.js:938:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  errno: -13,
  syscall: 'open',
  code: 'EACCES',
  path: '/usr/lib/node_modules/preact-cli/node_modules/nodent-runtime/dist/index.js'
}

Most helpful comment

Just to clarify - why would you need to install this as root? Doing so is _super_ dangerous - it's downloading megabytes of arbitrary code from the internet and executing it in a root shell.

All 4 comments

can you do sudo npm install -g preact-cli. As of yesterday we've hit stable with v3

The issue isn't different with that command.

You'll need to add the unsafe-perm flag.

sudo npm install -g --unsafe-perm preact-cli

Should work for you. Same as #802

Maybe worth adding instructions for?

Just to clarify - why would you need to install this as root? Doing so is _super_ dangerous - it's downloading megabytes of arbitrary code from the internet and executing it in a root shell.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jeanlucaslima picture jeanlucaslima  路  19Comments

davi-mbatista picture davi-mbatista  路  31Comments

rkostrzewski picture rkostrzewski  路  21Comments

ethanroday picture ethanroday  路  35Comments

alexeyraspopov picture alexeyraspopov  路  21Comments