In VScode, when initializing a NestJS project with TypeORM using git submodules, the initialization is performed within the submodule instead of

Currently, I am working on a project structured like this:

my_project
|
|
|
|
\----my_submodule
    |
    |
    |
    \----package.json
    \----tsconfig.json
|
|
|
\----package.json
\----tsconfig.json

It's important to note that my_project/package.json and my_project/my_submodule/package.json are the same

{
  "name": "my_project",
  "version": "1.0.0",
  "main": "handler.js",
  "scripts": {
    "lint": "eslint . --ext .ts,.tsx",
    "migration:generate": "ts-node -r tsconfig-paths/register ./node_modules/.bin/typeorm migration:generate -p -d src/local-data-source.ts src/migration/migrations",
    "migration:up": "ts-node -r tsconfig-paths/register ./node_modules/.bin/typeorm migration:run -d src/local-data-source.ts",
    "migration:list": "ts-node -r tsconfig-paths/register ./node_modules/.bin/typeorm migration:show -d src/local-data-source.ts",
    "migration:down": "ts-node -r tsconfig-paths/register ./node_modules/.bin/typeorm migration:revert -d src/local-data-source.ts",
    "db:diagram": "ts-node -r tsconfig-paths/register ./node_modules/.bin/typeorm-uml src/ormconfig.json"
  },
  "dependencies": {
    "pg": "^8.8.0",
    "reflect-metadata": "^0.1.13",
    "typeorm": "^0.3.9"
  },
  "devDependencies": {
    "@types/node": "^16.11.10",
    "@typescript-eslint/eslint-plugin": "^3.6.0",
    "@typescript-eslint/parser": "^3.6.0",
    "eslint": "^7.4.0",
    "eslint-config-airbnb-base": "^14.2.0",
    "eslint-import-resolver-alias": "^1.1.2",
    "eslint-plugin-import": "^2.22.0",
    "eslint-plugin-jest": "^23.18.0",
    "eslint-plugin-module-resolver": "^0.17.0",
    "eslint-plugin-prettier": "^3.1.4",
    "ts-node": "10.7.0",
    "tsconfig-paths": "^4.1.0",
    "typescript": "4.5.2",
    "typescript-eslint": "^0.0.1-alpha.0"
  },
  "config": {
    "typeorm": {
      "migrations_path": "src/migration"
    },
    "commitizen": {
      "path": "./node_modules/cz-conventional-changelog"
    }
  }
}

After running npm install, it seems that typeorm is being installed under my_project/my_submodule. How can I ensure that it gets installed under just my_project? It seems to work correctly for team members not using VSCode, so why isn't it consistent for me? I attempted adding rootDir to both directories but that didn't resolve the issue.

Answer №1

To resolve the issue, I included the submodule folder as an additional directory in my vscode workspace setup. Thus, within vscode, the structure now appears as:

my_project (which includes "my_submodule") my_submodule

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What could be causing the JWT token to not be transferred to the backend API when the page is reloaded or loaded?

In my user context, I encapsulate all components: const UserContext = ({ children }: AccountContextProviderProps) => { const [user, setUser] = useState({user: "", loggedIn: false}); const navigate = useNavigate(); useEffect(() => { ...

An error occurred when attempting to access the property 'push' of an undefined value while processing the SafeSubscriber._next function

There was an issue: Cannot read property 'push' of undefined at SafeSubscriber._next import { Component, OnInit } from '@angular/core'; import {StudentService} from '../student.service'; import {student} from '../ ...

Two tags attached to four hypertext links

Within my HTML code, I have hyperlinks present on every line. However, I am seeking to eliminate these hyperlinks specifically from "your previous balance" and "your new balance".https://i.sstatic.net/ekVGT.png In the following HTML snippet: <tr *ngFor ...

Using GSAP in an Ionic application

What is the best way to add the GSAP library to an Ionic project? Simply running npm install gsap doesn't seem to work when I try to import it using: import { TweenMax, TimelineMax} from "gsap"; I am currently using TypeScript. Thank you. ...

Leveraging external type definitions with certain types that are not made available for export

Currently, I am integrating TypeScript into my ReactJs project along with the Leaflet library for displaying world maps. The challenge arose when I needed to provide type definitions for the Leaflet library, but I discovered that they already exist as a no ...

Manually close the AntD Menu without using any shortcuts

I'm facing a unique situation with my table implemented using antd. Each row has a dropdown menu that opens a modal upon clicking. To ensure the dropdown menu doesn't trigger the row click event, I used stopPropagation on the menu item click. Eve ...

What is the best way to integrate the retry functionality from Rxjs into my await function?

When calling an await function in my code block, if it fails on the first try, I need to retry it. If it fails again on the second try, I want to display an error message. BELOW IS MY CODE SNIPPET async makeCall(inputs: myInputs): Promise<Instance> ...

How can I run a Redis Server on a port other than the default 6379 port using ioredis?

I recently came across this query regarding starting redis-server on a different port than the default 6379 in Ubuntu. I am currently trying to achieve the same using ioredis in my NestJS project, but unfortunately, it refuses to connect to any other port ...

Can you explain the process of utilizing Angular databinding to display nested information?

I'm facing a challenge with databinding when working with nested arrays in multiple timeslots and windows. Despite understanding the basics, I can't seem to make it work no matter how I try different approaches. It's really frustrating not k ...

Utilizing a nested interface in Typescript allows for creating more complex and

My current interface is structured like this: export interface Foo { data?: Foo; bar?: boolean; } Depending on the scenario, data is used as foo.data.bar or foo.bar. However, when implementing the above interface, I encounter the error message: Prope ...

Invoke a function within an Angular component that is passed in as a parameter

Is it possible to invoke a function using a string in JavaScript? I have a scenario where I receive a string as the function name, and I need to call and run that function. However, my current code is not working as expected. Below is the code snippet I ...

What is the best way to instantiate an object of type <T>?

I'm encountering an issue: class Collection<T extends IModel> extends Event implements ICollection<T> { constructor(array: any[] = []) { super() this._init(array) } private _init(array: any[]) { array.forEach( ...

Creating a standard arrow function in React using TypeScript: A Step-by-Step Guide

I am currently working on developing a versatile wrapper component for Apollo GraphQL results. The main objective of this wrapper is to wait for the successful completion of the query and then render a component that has been passed as a prop. The componen ...

Obtain the combination of values within an array object

I am attempting to write the specifications for a function that can take records of any structure and convert the values into a discriminated union. For example: const getKeys = <T extends {key: string}>(items: T[]): T['key'] => { // ...

Give it a little time before uploading a widget onto the page

As a newcomer to programming, I recently came across this code from an open source project. I am in the process of loading a widget onto a website. Instead of having the widget load instantly, I would like it to wait 10 seconds before displaying. Below i ...

Could you recursively transform one JSON-like type into another in typescript?

Exploring options for returning a generic type that encapsulates an array of something, the complexity of achieving this recursion is becoming apparent. With doubts arising, the feasibility of this task is being questioned. ...

Can you provide guidance on how to pass props to a component through a prop in React when using TypeScript?

Hey there, I'm facing an issue with TypeScript where the JavaScript version of my code is functioning properly, but I'm having trouble getting the types to compile correctly. In an attempt to simplify things for this question, I've removed ...

External JavaScript files cannot be used with Angular 2

I am attempting to integrate the twitter-bootstrap-wizard JavaScript library into my Angular 2 project, but I keep encountering the following error: WEBPACK_MODULE_1_jquery(...).bootstrapWizard is not a function I have created a new Angular app using a ...

An error occurred in Nest JS, specifically in the node_modules/jest-diff/build/diffLines.d.ts file at line 8, character 13. The error message is "error TS1005:

Whenever I start and run the NestJS app in watch mode by using the npm run start:dev command, I encounter the following error: ERROR in node_modules/jest-diff/build/diffLines.d.ts(8,13): error TS1005: '=' expected. node_modules/jest-diff/build/d ...

Wondering how to implement HubSpot Conversations SDK in a Typescript/Angular application?

Recently, I came across some useful javascript code on this website window.HubSpotConversations.widget.load(); window.HubSpotConversations.widget.refresh(); window.HubSpotConversations.widget.open(); window.HubSpotConversations.widget.close(); Now, I am l ...