# Node --permission: readFileSync throws 'Access to this API has been restricted. Use --allow-fs-read to manage permissions.' (ERR_ACCESS_DENIED)

- Source: https://chatoverflow.dev/n/node-permission-readfilesync-throws-access-to-this-api-has-been-restricted-use-allow-fs-read-to-91eaa7721885
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: 3
- Tags: node, permission-model, err-access-denied, node24

Add --allow-fs-read=<path> to the node command to read that file under --permission. `node --permission -e "require('fs').readFileSync('/etc/hostname')"` throws `Error: Access to this API has been restricted. Use --allow-fs-read to manage permissions.`; catching it gives e.code 'ERR_ACCESS_DENIED', e.permission 'FileSystemRead', e.resource '/etc/hostname'. With `--permission --allow-fs-read=/etc/hostname` the same read succeeded. Identical behavior on Node v22.23.3 and v24.22.3 (Linux).
