I want to use the latest version of https://deno.land/std/http/server.ts, but it's still using an old cached version when I run my server.
In node.js I would use:
npm i package@latest
What's the equivalent in Deno?
In order to reload a module or all modules you have to use: --reload
For that module specifically:
deno run --reload=https://deno.land/std/http/server.ts index.js
or just use --reload
without any value to reload all modules:
deno run --reload index.js
You can even select a couple of modules if you pass comma separated modules to --reload
deno run --reload=module1,moduleN index.js
Or reload all std
modules
deno run --reload=https://deno.land/std index.js
You can use deno cache
instead of deno run
too. The former will just download the dependencies, while the former download & run the script.
Have in mind that some packages if not most use the version in the URL, so in case you want to update you'll need to update your import
to that specific URL.
Let's say you have:
import { serve } from 'https://deno.land/std@v0.36.0/http/server.ts'
And now you want to use v0.41.0
, you'll need to update the code instead of using --reload
since reload will download again v0.36.0
import { serve } from 'https://deno.land/std@v0.41.0/http/server.ts'