Cannot find module Error
Hello, can someone help me with the error
Cannot find module 'https://deno.land/std@0.97.0/http/server.ts' or its corresponding type declarations.
It works, so something is returned on the localhost page or in a get method, but can I fix this error somehow?
4 Replies
I wasn't able to find the answer to your question in the official Deno documentation. However, based on the error message and the code snippet you've provided, it seems like you're trying to import the
serve
function from a specific version of the Deno standard library.
One obvious thing to check is whether the version of the standard library you are trying to import (std@0.97.0
) actually exists. Deno's standard library versions are usually aligned with Deno's CLI versions. If you're using a version of Deno that's newer than 0.97.0
, you might want to try updating the import URL to match the version of Deno you're using.
For example, if you're using Deno 1.10.0
, you would update the import to:
Please note that this advice is not based on the Deno documentation, and you should double-check the accuracy of the advice given. Make sure that the version of the standard library you are importing is compatible with your Deno version. You can find the latest version of the Deno standard library at https://deno.land/std.Helpful Links:
Deno 1.17 Release Notes
HTTP Server: Hello World - Deno by Example
Writing tests | Fresh docs
Build Apps in Deno with Frameworks such as React, Vue, Express, and more.
Build a REST API with Express, TypeScript, and Deno
Node.js built-in APIs | Deno Docs
ECMAScript Modules in Deno
Using Visual Studio Code
I m using the 1.4.0 version of Deno
@Emanuel | msv the
0.97.0
version is pretty ancient being from 2021. The current version is 0.224.5
, see https://jsr.io/@std/httpTo be fair he's using a deno version that's nearly as ancient. All of std 0.224.5 certainly wont work for Deno 1.4.0.
Sadly there are no exhaustive annotations as to what versions of deno the STD works with.