festusyuma
festusyuma2mo ago

Running Deno Install with --entrypoint does not read package.json properly in docker

I am currently deploying deno to lambda using the docker image, I have some npm packages listed in my package.json as I was not getting type suggestions when using them in the deno.json file the problem now is, whenever I run deno Install --entrypoint main.ts I get this error for all the dependencies in package.json
Relative import path "zod" not prefixed with / or ./ or ../ and not in import map from "file:///var/task/main.ts"
Relative import path "zod" not prefixed with / or ./ or ../ and not in import map from "file:///var/task/main.ts"
but it goes away when I add the package to the deno.json file. This also works properly without the --entrypoint flag but it installs all the dependencies including devDependencies which is not ideal
6 Replies
festusyuma
festusyumaOP2mo ago
Seems it also installs all the dependencies in the package.json file after adding it to the deno.json
bartlomieju
bartlomieju2mo ago
If you have package.json you don't need to run with --entrypoint flag
festusyuma
festusyumaOP2mo ago
oh, do I need to specify the main file in the package.json? I had the impression that it used the entry point to know which packages to install or when I start it somewhere in the docs, it mentiones deno install is required when using package.json
bartlomieju
bartlomieju2mo ago
Yes, if you have a package.json then deno install is usually prefered But if you list all your dependencies in that file you can just run deno install without --entrypoint You only need --entrypoint if you want to cache all dependencies from a file that uses npm: or jsr: specifiers
festusyuma
festusyumaOP2mo ago
The problem without using the entrypoint is I was getting all the dependencies cached, including dev dependencies only needed for deployment
bartlomieju
bartlomieju2mo ago
MMM, good point, i thought we had a flag for that But maybe not

Did you find this page helpful?