[ERR_MODULE_NOT_FOUND]

I get this error, and, surely, going into the aformentioned path to check, I don't seem to have the file it's looking for - even though the directory exists. (See the attached image)
PS C:\Users\Emil\Projects\emoji-game> deno run dev
Task dev deno run --allow-net --allow-read server.ts
error: Could not resolve 'npm:http@0.0.1-security'.

Caused by:
[ERR_MODULE_NOT_FOUND] Cannot find module 'file:///C:/Users/Emil/AppData/Local/deno/npm/registry.npmjs.org/http/0.0.1-security/index.js' imported from 'file:///C:/Users/Emil/Projects/emoji-game/server.ts'
PS C:\Users\Emil\Projects\emoji-game> deno run dev
Task dev deno run --allow-net --allow-read server.ts
error: Could not resolve 'npm:http@0.0.1-security'.

Caused by:
[ERR_MODULE_NOT_FOUND] Cannot find module 'file:///C:/Users/Emil/AppData/Local/deno/npm/registry.npmjs.org/http/0.0.1-security/index.js' imported from 'file:///C:/Users/Emil/Projects/emoji-game/server.ts'
Does anyone know how to fix this dependency issue? Do I need to run some sort of update/install/sync command for my environment? I thought you could just reference npm modules by prefixing the import paths with npm:
No description
7 Replies
gamer'); DROP TABLE users; /*
My imports inside server.ts
import type { Socket } from 'npm:socket.io';
import express from 'npm:express';
import { createServer } from 'npm:http';
import { Server } from 'npm:socket.io';
import { createClient, RedisClientType, RedisDefaultModules } from 'npm:redis';
import YAML from 'npm:yaml';
import { User } from "./class/User.ts";
import type { Socket } from 'npm:socket.io';
import express from 'npm:express';
import { createServer } from 'npm:http';
import { Server } from 'npm:socket.io';
import { createClient, RedisClientType, RedisDefaultModules } from 'npm:redis';
import YAML from 'npm:yaml';
import { User } from "./class/User.ts";
Does this have something to do with express and Deno looking for different versions of http or something?
bartlomieju
bartlomieju2w ago
That looks like an actual bug inside Deno resolver. It should try to resolve npm:http@1.0.0-security. it should be something like npm:http@1.0.0/security Probably something we can fix in a day
gamer'); DROP TABLE users; /*
Awesome. Do you want me to provide you with any more information? oh wait it just writes the version prefix in reverse is there a monkeypatch fix i can apply to the imports/urls to make it point to the right module version? so i can test my app tonight
bartlomieju
bartlomieju2w ago
Soo, this is fun!
bartlomieju
bartlomieju2w ago
It appears you should use from "node:http" instead of from "npm:http" - because the package on npm is https://www.npmjs.com/package/http
npm
http
security holding package. Latest version: 0.0.1-security, last published: 5 years ago. Start using http in your project by running npm i http. There are 2206 other projects in the npm registry using http.
bartlomieju
bartlomieju2w ago
Which is just a holder I've no idea what goes on under the hood, but I will open an issue to provide a better message But the change above will unblock you
bartlomieju
bartlomieju2w ago
GitHub
import { createServer } from "npm:http" fails in a strange way · ...
Version: Deno 2.0.0-rc.7 import { createServer } from "npm:http" $ deno run main.ts error: Could not resolve 'npm:http@0.0.1-security'. Caused by: [ERR_MODULE_NOT_FOUND] Cannot fi...