Skip to content
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

npm install esbuild got permission denied #369

Closed
humbinal opened this issue Sep 5, 2020 · 4 comments · Fixed by #1621
Closed

npm install esbuild got permission denied #369

humbinal opened this issue Sep 5, 2020 · 4 comments · Fixed by #1621

Comments

@humbinal
Copy link

humbinal commented Sep 5, 2020

[root@localhost ~]# npm install esbuild

> esbuild@0.6.30 postinstall /root/node_modules/esbuild
> node install.js

Trying to install "esbuild-linux-64" using npm
Failed to install "esbuild-linux-64" using npm: EACCES: permission denied, mkdir '/root/node_modules/esbuild/.install'
Trying to download "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.6.30.tgz"
/root/node_modules/esbuild/install.js:176
      throw e;
      ^

Error: EACCES: permission denied, open '/root/node_modules/esbuild/bin/esbuild'
    at Object.openSync (fs.js:465:3)
    at Object.writeFileSync (fs.js:1416:35)
    at /root/node_modules/esbuild/install.js:70:8
    at Generator.next (<anonymous>)
    at fulfilled (/root/node_modules/esbuild/install.js:6:24)
    at processTicksAndRejections (internal/process/task_queues.js:93:5) {
  errno: -13,
  syscall: 'open',
  code: 'EACCES',
  path: '/root/node_modules/esbuild/bin/esbuild'
}
npm WARN enoent ENOENT: no such file or directory, open '/root/package.json'
npm WARN root No description
npm WARN root No repository field.
npm WARN root No README data
npm WARN root No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! esbuild@0.6.30 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the esbuild@0.6.30 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-09-05T15_42_39_991Z-debug.log

then i set env not download, the problem remains the same.

export ESBUILD_BIN_PATH_FOR_TESTS=/usr/local/bin/esbuild

[root@localhost ~]# npm install esbuild

> esbuild@0.6.30 postinstall /root/node_modules/esbuild
> node install.js

internal/fs/utils.js:269
    throw err;
    ^

Error: EACCES: permission denied, unlink '/root/node_modules/esbuild/bin/esbuild'
    at Object.unlinkSync (fs.js:1136:3)
    at installOnUnix (/root/node_modules/esbuild/install.js:172:8)
    at Object.<anonymous> (/root/node_modules/esbuild/install.js:213:3)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878: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: 'unlink',
  code: 'EACCES',
  path: '/root/node_modules/esbuild/bin/esbuild'
}
npm WARN enoent ENOENT: no such file or directory, open '/root/package.json'
npm WARN root No description
npm WARN root No repository field.
npm WARN root No README data
npm WARN root No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! esbuild@0.6.30 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the esbuild@0.6.30 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-09-05T15_58_04_212Z-debug.log

There is a very confused problem. Who can help me?

@evanw
Copy link
Owner

evanw commented Sep 5, 2020

Can you provide more details about your situation? What operating system are you using? How are the permissions configured for /root? Are there multiple users involved? Ideally the best case would be if you have enough information to provide a series of steps to reproduce the problem from scratch so I could reproduce it on my end.

@humbinal
Copy link
Author

humbinal commented Sep 6, 2020

Can you provide more details about your situation? What operating system are you using? How are the permissions configured for /root? Are there multiple users involved? Ideally the best case would be if you have enough information to provide a series of steps to reproduce the problem from scratch so I could reproduce it on my end.

CentOS8.2, root user , has all permissions for all dirs. I also test centos7, the problem are still the same, and change node version from v14.9.0 to v12.18.3, the problem are still the same.
I tried by other linux user(not has root permission), and is ok , but don't known why root can't work? in my project, must use root.

@evanw
Copy link
Owner

evanw commented Sep 6, 2020

Ah. This might not be something I can debug on my end. I tried installing CentOS into a VM but it didn't result in an OS with an internet connection, so I was unable to test anything.

I found this Stack Overflow answer which says that if you're using npm with the root user and a package has an install script, you'll need to add --unsafe-perm=true to your npm command to get it to work. Does that work for you?

@humbinal
Copy link
Author

humbinal commented Sep 7, 2020

@evanw I add --unsafe-perm=true for npm install command, and it works !
It's my problem. I didn't know this npm feature before.
thank you very much for your help !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants