HTTP Client in JetBrains IDE does not load npm packages from local npm_modules – Stack Overflow

I have following project structure

project-root
  |- package.json
  |- tests
       |- http
            |- ws.http
            |- session.js
           

with package.json

{
  "name": "dummy",
  "version": "1.0.0",
  "type": "module",
  "directories": {
    "testHttp": "tests/http"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@aws-sdk/client-cognito-identity-provider": "^3.616.0"
  }
}

and ws.http

# tests/http/ws.http

### Simple WebSocket Request
// It is possible to send messages to server right from the Services tool window

< {%
    import { session } from "./session.js"
    session()
%}

WEBSOCKET ws://{{wsBaseUrl}}

and session.js

// tests/http/session.js

import { CognitoIdentityProviderClient, ListUsersCommand } from "@aws-sdk/client-cognito-identity-provider";

export const session = () => {

}

When I run then session.js file then it properly imports all required packages. But when I run it from JetBrains IDE runner via HTTP client, then I get following error

Syntax error: cannot find file for module '@aws-sdk/client-cognito-identity-provider'

What’s the correct configuration of project structure so that the JetBrains IDE and its HTTP client uses packages from local node_modules?

I also installed the package globally via npm install -g and it’s not picked either.

Read more here: Source link