How to update package-lock.json without doing npm install?

npm As of npm 6.x, you can use the following command: npm i –package-lock-only Documentation (https://docs.npmjs.com/cli/install.html) says: The –package-lock-only argument will only update the package-lock.json, instead of checking node_modules and downloading dependencies. yarn As of yarn 3.0.0, you can use the following command: yarn install –mode update-lockfile Documentation (https://yarnpkg.com/cli/install#options-mode%20%230) says: If the –mode=<mode> option is … Read more

why does yarn warn when adding a dependency to the root workspaces package.json

Since you are using Yarn Workspaces and it manages the dependencies of all projects (workspaces), you should add dependencies of each project to its own package.json, not the workspace root. Yarn uses only one yarn.lock file that is placed in the workspace root. Also, it tries to move dependencies of all projects to node_modules of … Read more

Running NodeJS project in Visual Studio Code with yarn

I ended up having the following configuration in launch.json: { “type”: “node”, “request”: “launch”, “name”: “Launch via Yarn”, “runtimeExecutable”: “yarn”, “cwd”: “${workspaceFolder}”, “runtimeArgs”: [“start:debug”], “port”: 5858 } And the following entry in the scripts property inside package.json: “start:debug”: “node –inspect-brk=5858 ./server/index.js”, You could include a timeout key (which defaults to 10000) and increase its value … Read more

How to use yarn workspaces with typescript and out folders?

I created a Github Repository to make it easier to follow the following code description: Code Description TypeScript Project References make it possible to compile a TypeScript project that consist of multiple smaller TypeScript projects, each project having a tsconfig.json file. (Source: Project References Documentation) TypeScript Setup We have a root tsconfig.json file that only … Read more

yarn upgrade to fix yarn audit errors

The solution to this problem in yarn is called selective version resolutions which is basically defining resolutions for the transitive dependencies in the package.json. The transitive dependencies are the dependencies of dependencies. { “resolutions”: { “**/**/lodash”: “^4.17.12” } } So here even if the lodash isn’t a direct dependency of your package, the dependent package … Read more