Running with --cached-only not working
First I cache all dependencies of my typescript file:
deno cache --lock=deno.lock --lock-write server.ts
Then I try to execute the file using --cached-only
:
deno run --cached-only --allow-net --allow-read --allow-sys --allow-env --allow-run server.ts
Then I get e.g. the following error:
error: Error getting response at https://registry.npmjs.org/@aws-sdk/client-rds-data for package "@aws-sdk/client-rds-data": An npm specifier not found in cache: "@aws-sdk/client-rds-data", --cached-only is specified.
Why isn't @aws-sdk/client-rds-data
cached by the first command if it's needed when I run server.ts
?3 Replies
I wasn't able to find the answer to your question in the official Deno documentation. However, based on the information you've provided, it seems like there might be an issue with how the dependencies are being cached.
The
deno cache
command should indeed cache all the dependencies of your TypeScript file. If @aws-sdk/client-rds-data
is a dependency that is imported in server.ts
, it should be cached by the deno cache
command. Make sure that the import URL in your server.ts
file is correct and that it points to a valid module.
Please note that the advice provided here is not based on the Deno documentation, and I would advise you to double-check the accuracy of the advice given. If the issue persists, it might be helpful to ensure that all import URLs in your TypeScript file are correct and that there are no typos or mistakes. Additionally, you might want to verify that the lock file (deno.lock
) is being updated correctly and includes all necessary dependencies.Are you importing it statically or dynamically? In other words, are you using the
import
statement or the import()
function?@Leokuma Actually I am not using this dependency directly, it's a dependency of a dependency. My dependency might be importing it dynamically.
But actually I've seen the same issue with one of my direct dependencies. In my
dependencies.ts
I am importing a type using // @deno-types="npm:@types/express@4.17.15"
, and it gave the same error for @types/express@4.17.15