D
Deno

help

Read permission & NPM imports

Kkaki879/9/2023
Hello, I'm using --allow-read=. to allow a script to read files in the current directory. The script also use NPM imports, because of which it also asks to read /home/{username}/.cache/deno. Can I not need to explicitly allow this path, especially since it will differ depending on operating systems and installation modes ? Thanks
DAHDeno AI Helper9/9/2023
Hello! ๐Ÿฆ• The Deno cache directory is used to store the downloaded dependencies, including npm packages. When you import an npm package, Deno fetches it and stores it in this cache directory. Therefore, the script needs read access to this directory to be able to load the dependencies. However, you don't need to explicitly allow read access to the Deno cache directory. When you grant the --allow-read permission, it only restricts access to the file system outside of the Deno internal directories. The Deno cache directory is considered an internal directory, and Deno scripts have automatic access to it. So, using --allow-read=. should be sufficient for your use case. It will allow the script to read files in the current directory and also load npm packages from the Deno cache directory. I hope this helps! Let me know if you have any other questions.
Lleigh9/10/2023
Are you loading an npm import dynamically? Could that be why it's asking for permission?
Kkaki879/10/2023
Nope, here are my imports :
import { join as joinPath } from 'https://deno.land/std@0.201.0/path/mod.ts';

import createFastify from 'npm:fastify@4.22.2';
import fastifyStatic from 'npm:@fastify/static@6.11.0';
import fastifyView from 'npm:@fastify/view@8.0.0';
import Handlebars from 'npm:handlebars@4.7.8';
import { join as joinPath } from 'https://deno.land/std@0.201.0/path/mod.ts';

import createFastify from 'npm:fastify@4.22.2';
import fastifyStatic from 'npm:@fastify/static@6.11.0';
import fastifyView from 'npm:@fastify/view@8.0.0';
import Handlebars from 'npm:handlebars@4.7.8';
Here's my command :
deno run --allow-read=. --allow-env --allow-sys=hostname --allow-net ./main.js
deno run --allow-read=. --allow-env --allow-sys=hostname --allow-net ./main.js
And here's the output :
โ”Œ :warning: Deno requests read access to "/home/kaki/.cache/deno/npm/node_modules".
โ”œ Run again with --allow-read to bypass this prompt.
โ”” Allow? [y/n/A] (y = yes, allow; n = no, deny; A = allow all read permissions) >
โ”Œ :warning: Deno requests read access to "/home/kaki/.cache/deno/npm/node_modules".
โ”œ Run again with --allow-read to bypass this prompt.
โ”” Allow? [y/n/A] (y = yes, allow; n = no, deny; A = allow all read permissions) >
@leighmcculloch ๐Ÿ™
Lleigh9/10/2023
What version of Deno?
Kkaki879/11/2023
1.36.4
LLeokuma9/11/2023
If Deno is complaining because of a require() call, I think that shouldn't happen. But if one of your deps is opening a file dynamically, then I'm not sure what the behavior should be I think you can use deno vendor to put all deps in the current folder. Not sure if it works for node modules, though
Kkaki879/11/2023
if one of your deps is opening a file dynamically, then I'm not sure what the behavior should be
I see. How could I know where exactly does the permission request comes from ?
LLeokuma9/13/2023
I don't know ๐Ÿ˜…
Kkaki879/14/2023
@leighmcculloch ๐Ÿ™
Lleigh9/14/2023
I randomly started experiencing the same issue. Opened issue: https://github.com/denoland/deno/issues/20484
GitHub
Importing npm dep requires --allow-read of node_modules ยท Issue #20...
What version of Deno are you using? โฏ deno --version deno 1.36.4 (release, aarch64-apple-darwin) v8 11.6.189.12 typescript 5.1.6 What did you do? Created a basic project that imports an npm: depend...

Looking for more? Join the community!

Recommended Posts
WebSocket connections killing setInterval()Hey Deno friends, it appears that websocket connections are somehow stopping the execution of setIntjsx in jsAll of my files containing JSX are in `.js` files. Is there an easy fix for this when running?http errorI need help because I have a service that has more than 1 million requests per day and for about 7 ddoes Deno vscode support nesting `deno.json`?There is a project I'm working on has nesting `deno.json` files. The parent `deno.json` is a bit outDeploy says Worker not defined for ESBuild (wasm.js)@Deno AI Helper I am having trouble understanding how to get the esbuilder to work on Deno Deploy, udeno_tui Label-classHello. I just started testing around with deno_tui and found the DrawObject-Class. How do i actuallyCannot read file "src/deno.json": not implemented on jsHey @Deno AI Helper ! I'm having a bit of trouble, I'm trying to use `deno.land/x/import` to use nonError running Apollo example (on latest version)Hi. When I run this example with the latest version of apollo from npm I get errors: https://deno.Example Question for the Deno AI BotHey there - this is an example question for the Deno AI bot. How would I write a regular expression Does Deno support `export type` statements?Hello, we are using Deno + TS and I am getting the following error if I try to export a type from anHow can one patch a Deno dependency?Hello, We're used to working with node and using `patch-package` to override and fix packages fairlyError running program that uses `fp-ts` from npm (`Is a directory (os error 21)`)https://github.com/Industrial/test-fp-ls/blob/main/mod.ts When I run `deno run -A mod.ts` I get: `Can't "Sign in" to deno deployHi There, I can't sign in to deno deploy. The first time I try it works, and it sets up the GitHub ADoes Deno NPM support other registries like github npm registry?Does Deno NPM support other registeries like github and if so, does it support private registeries?Piping streams through a shell program (ffmpeg) and writing the output to a fileI've been trying to use `ffmpeg` on the backend of my super simple audio-uploading app. I can save tUsing Deno to run JavaScript from GolangI just started looking into this, but I'm looking for something like rogchap.com/v8go but it would bRust compile deno_runtime errorHi <:ferrisUpsideDown:920769146399100958> I've been this error when I'm compiling my code that uselsp bug?Is there any reason why intellisense would identify the type correctly, but after completion it woulConvert m3u8 stream to mp4?Hey. Whats the best /fastest way to convert a m3u8 stream (all files are in a local folder) to a norGetting error trying to download NPM package``` Download https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.6.0.tgz D