nodeSolidServer / nodeSolidServer/node-solid-server
Improve error handling for invalid setup for directory permissions
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.8k
- Forks
- 308
- PR merge metrics
- No merged PRs in 30d
Description
When I started the server, I got this error:
ERROR You need root privileges to start on this port
It doesn't make sense because I wasn't running on port 80. So debugging it more (added console statements), I found that the true error was the following:
{ Error: EACCES: permission denied, mkdir '/var/www/solid.mysite/config/templates'
at Object.fs.mkdirSync (fs.js:885:18)
at mkdirsSync (/usr/lib/node_modules/solid-server/node_modules/fs-extra/lib/mkdirs/mkdirs-sync.js:31:9)
at Object.mkdirsSync (/usr/lib/node_modules/solid-server/node_modules/fs-extra/lib/mkdirs/mkdirs-sync.js:37:16)
at Object.copySync (/usr/lib/node_modules/solid-server/node_modules/fs-extra/lib/copy-sync/copy-sync.js:49:37)
at ensureDirCopyExists (/usr/lib/node_modules/solid-server/lib/server-config.js:25:8)
at Object.initTemplateDirs (/usr/lib/node_modules/solid-server/lib/server-config.js:108:29)
at createApp (/usr/lib/node_modules/solid-server/lib/create-app.js:45:27)
at Function.createServer (/usr/lib/node_modules/solid-server/lib/create-server.js:15:18)
at bin (/usr/lib/node_modules/solid-server/bin/lib/start.js:122:17)
at fs.readFile (/usr/lib/node_modules/solid-server/bin/lib/start.js:41:7)
errno: -13,
code: 'EACCES',
syscall: 'mkdir',
path: '/var/www/solid.mysite/config/templates' }
It should assist the user to fix their permissions not run it in root.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in bin/lib/start.js, then follow the startup path through lib/create-server.js, lib/create-app.js, and lib/server-config.js, especially the template-directory initialization. Reproduce startup with a directory that cannot be created and inspect how the EACCES failure is reported. Done means the permission error is surfaced accurately instead of being reported as a root-privilege or port error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100