问题
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