Azure / Azure/azure-functions-core-tools
permission denied when trying to install
- Dominant language
- C#
- Stars
- 1.5k
- Forks
- 498
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 13
Description
Ubuntu 18.04. Running as root:
```
$ sudo -Hi
# npm install -g azure-functions-core-tools
/usr/local/bin/func -> /usr/local/lib/node_modules/azure-functions-core-tools/lib/main.js
/usr/local/bin/azfun -> /usr/local/lib/node_modules/azure-functions-core-tools/lib/main.js
/usr/local/bin/azurefunctions -> /usr/local/lib/node_modules/azure-functions-core-tools/lib/main.js
> azure-functions-core-tools@2.7.2508 postinstall /usr/local/lib/node_modules/azure-functions-core-tools
> node lib/install.js
attempting to GET "https://functionscdn.azureedge.net/public/2.7.2508/Azure.Functions.Cli.linux-x64.2.7.2508.zip"
[------------------] Downloading Azure Functions Core Toolsevents.js:174
throw er; // Unhandled 'error' event
^
Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/azure-functions-core-tools/bin'
Emitted 'error' event at:
at errorOrDestroy (internal/streams/destroy.js:107:12)
at DuplexWrapper.onerror (_stream_readable.js:734:7)
at DuplexWrapper.emit (events.js:198:13)
at Readable. (/usr/local/lib/node_modules/azure-functions-core-tools/node_modules/duplexer2/index.js:49:12)
at Writable.emit (events.js:203:15)
at errorOrDestroy (internal/streams/destroy.js:107:12)
at onwriteError (_stream_writable.js:436:5)
at onwrite (_stream_writable.js:461:5)
at ProxyWriter.emit (events.js:203:15)
at FileWriter.emit (events.js:198:13)
at FileWriter.Abstract.error (/usr/local/lib/node_modules/azure-functions-core-tools/node_modules/fstream/lib/abstract.js:63:13)
at /usr/local/lib/node_modules/azure-functions-core-tools/node_modules/fstream/lib/writer.js:171:25
at /usr/local/lib/node_modules/azure-functions-core-tools/node_modules/mkdirp/index.js:48:53
at FSReqWrap.oncomplete (fs.js:153:21)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! azure-functions-core-tools@2.7.2508 postinstall: `node lib/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the azure-functions-core-tools@2.7.2508 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-05-21T14_26_41_113Z-debug.log
# mkdir -p /usr/local/lib/node_modules/azure-functions-core-tools/bin
# ls /usr/local/lib/node_modules/azure-functions-core-tools/
bin
# npm install -g azure-functions-core-tools
/usr/local/bin/func -> /usr/local/lib/node_modules/azure-functions-core-tools/lib/main.js
/usr/local/bin/azfun -> /usr/local/lib/node_modules/azure-functions-core-tools/lib/main.js
/usr/local/bin/azurefunctions -> /usr/local/lib/node_modules/azure-functions-core-tools/lib/main.js
> azure-functions-core-tools@2.7.2508 postinstall /usr/local/lib/node_modules/azure-functions-core-tools
> node lib/install.js
attempting to GET "https://functionscdn.azureedge.net/public/2.7.2508/Azure.Functions.Cli.linux-x64.2.7.2508.zip"
[------------------] Downloading Azure Functions Core Toolsevents.js:174
throw er; // Unhandled 'error' event
^
Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/azure-functions-core-tools/bin'
Emitted 'error' event at:
at errorOrDestroy (internal/streams/destroy.js:107:12)
...
```
Attaching log file from npm:
[2020-05-21T14_27_44_280Z-debug.log](https://github.com/Azure/azure-functions-core-tools/files/4663013/2020-05-21T14_27_44_280Z-debug.log)
Contributor guide
Research direction
Start with lib/install.js and the npm postinstall script, then reproduce the global installation on Ubuntu 18.04 using the command and log provided. Determine why the script cannot create /usr/local/lib/node_modules/azure-functions-core-tools/bin despite running as root; done means the package installs successfully without the EACCES failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, node.js, ubuntu
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100