How to avoid permission issues when using denon

耗尽温柔 提交于 2020-05-29 06:52:18

问题


I was running denon, which is like nodemon in node, but I'm getting permission issues even when I've manually specified the relevant flags (specifically --allow-net flag.)

How do I run my app with denon so I don't have to keep restarting?


回答1:


Without knowing the exact error it's hard to give you the correct answer, but denon is unstable, it has several issues.

One of those errors that you might be affecting you is if you're trying to watch a folder that you may not have ownership you'll get:

error: Uncaught PermissionDenied: Permission denied (os error 13)

for example, if I run denon on /tmp I get that error thrown, even if the folder has all permissions.

Even though nodemon works perfectly on /tmp.


My recommendation is to use nodemon until denon is stable or until there's a better tool for deno.

You can do so by using --exec flag

nodemon --exec deno run --allow-net index.ts

For convenience you can use nodemon.json with the following content:

{
  "execMap": {
    "js": "deno run --allow-net",
    "ts": "deno run --allow-net"
  },
  "ext": "js,json,ts"
}

And now just use: nodemon index.ts




回答2:


You can create a denon.json file in your project root.

{
  "scripts": [
    "start": "deno run --allow-env --allow-net server.ts"
  ]
}

Then you can run the script this way:

denon start

https://deno.land/x/denon

Hope it helps!



来源:https://stackoverflow.com/questions/61869499/how-to-avoid-permission-issues-when-using-denon

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!