Specific package-lock.json file for npm workspace environments

I have two separate packages within my npm workspace called api and cdk. I need to generate distinct package-lock.json files for both api and cdk, because each project will be deployed separately. Is it currently feasible to accomplish this using npm workspaces? If not, what are some alternative approaches or strategies that could be employed?

├── api
│    ├── package.json
├── cdk
│   ├── package.json
├── node_modules
├── package.json
├── package-lock.json 

Answer №1

When using npm install for workspaces, a package-lock.json file will not be generated. This is because workspaces allow for dependencies to be shared among each other.

To manage your CI/CD process effectively, it is recommended to use the root package-lock.json and package.json files for each workspace.

A helpful approach would be to create a root builder Dockerfile that installs all the dependencies. Subsequently, each workspace's Dockerfile can then copy the dependencies from the root builder.

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

Struggling with resolving a system error that popped up during the installation of Vue CLI in Node? You may have encountered the message "A system

After installing npm 9.2.0 and nodev16.16.0 on my Windows 7 system, I attempted to install vue cli but encountered an error message when trying to check the version of the vue cli. Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporati ...

A guide to identifying web crawlers for search engine optimization with the help of Express

I have been on the lookout for npm packages to assist me in detecting crawlers, but all I find are outdated and unmaintained ones that rely on obsolete user-agent databases. Is there a dependable and current package available that can aid me in this task? ...

Resolving create-react-app integrity issue on Windows

I encountered these errors while setting up a react app on my Windows 10 computer. Can someone please assist me in resolving this issue? PS F:\> npm install -g create-react-app C:\Users\Harshit Singh\AppData\Roaming\npm&bs ...

Fresh install resulted in an unmet peer dependency error even after deleting both node_modules and package.json files

Recently, I've been facing issues with NPM not recognizing or installing the packages listed in my package.json file. I keep receiving warnings that prevent my build from passing, which is a major concern. Specifically: npm WARN [email protec ...

Encountering the issue of react-router peerDependencies not being

I am encountering an issue while attempting to install react-router as I receive the following error message. $ npm install react-router npm WARN peerDependencies The peer dependency <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfem ...

Having trouble resolving npm install -g @angular/cli due to issue with checking the installable status of [email protected] module

When attempting to install @angular/cli using the npm command in the command prompt, I encountered an issue with resolveWithNewModule. It seems to be stuck at checking installable status.[email protected] ...

Attempting to execute npm install for an Odin project task, encountered the error "Module not Found". // A new error has surfaced, continue reading below

Trying to run npm install for the Odin Project JavaScript Fundamentals Part 4 lesson has been quite a challenge. Initially, upon forking and cloning the repository and running npm install as per the instructions, I encountered a permission error. However, ...

Latest version of npm is not available for mac users

Recently, I have been exploring the world of iOS and decided to install npm. The version I currently have is 5.6.0, but now I want to update it. Here are the steps I'm taking to update npm: I started by opening the terminal and typing npm -v to c ...

A node module designed to efficiently convert multiple TIFF images into a single multipage TIFF document

Looking to combine several tiff images into a single file using nodejs/javascript. Is there a method to create a single tiff file with multiple pages from separate tiff images in nodejs? Can we convert a multi-page pdf into one tiff image using nodejs? ...

Getting Started with Styling in React Using Styled Components

I seem to be having trouble with styled components; something must be off in my setup. Here's the component I'm working with: import React from 'react'; import styled from 'styled-components'; const Wrapper = styled.div` d ...

Is there a way to regenerate bundle.js using npm start?

Can anyone help me figure out how NPM start functions? I have a package.json file with some scripts, but when I update the script, the bundle.js does not recompile automatically. I'm running "npm start" from the console. This is a part of my package. ...

Encountered a surprise JSON ERROR during installation of a React Native package

I encountered an issue while trying to add the firebase package to my React Native project. npm i --save firebase When running the above command, I received the following error: npm ERR! Unexpected end of JSON input while parsing near '...5L/bQQbhWxI ...

"Extra loader required to manage output from these loaders." error encountered in React and Typescript

After successfully writing package 1 in Typescript and running mocha tests, I confidently pushed the code to a git provider. I then proceeded to pull the code via npm into package 2. However, when attempting to run React with Typescript on package 2, I enc ...

Can the parcel bundler dist folder be customized for decoration?

After compiling code with parcel using the command parcel src/index.html, all files are generated inside the dist folder. However, I am looking for a more organized way to manage these files once my website is complete. Ideally, I want separate folders suc ...

What functionalities does yarn offer that are not currently present in npm v5.0?

With the release of npm v5.0, many features currently found in yarn are now included: The default installation includes --save. package-lock.json will be generated automatically (assumed to ensure consistent installs). Automatic fallback-to-offline mode. ...

Encountering a problem while attempting to set up browser-sync on Ubuntu system

Updated Node to the latest stable version v7.4.0 Encountering an error message while trying to install browser-sync: sudo npm install -g browser-sync 'npm ERR! Linux 4.4.0-59-generic npm ERR! argv "/usr/local/bin/node" "/usr/loca ...

The attempt to access http://registry.npmjs.org/check was unsuccessful due to a connection error (ECONNREFUSED)

Upon executing the command "npm install -g check" in the cmd prompt, I encountered the following error: npm ERR! code ECONNREFUSED npm ERR! errno ECONNREFUSED npm ERR! FetchError: request to http://registry.npmjs.org/check failed, reason: connect ECONNREF ...

Windows is experiencing difficulty installing the package "truffle" through NPM

Recently, I attempted to set up "truffle" using npm, but my lack of familiarity with NodeJS has left me puzzled as to why npm refuses to install it. Upon running npm install -g truffle in Powershell with Admin privileges, a series of error messages appeare ...

Encountered a problem when attempting to launch the React application

[Issue encountered while attempting to launch myfirstreact with npm start] Hello everyone, I am a beginner in the world of React. I am currently facing a problem when trying to run myfirstreact using npm start. Despite receiving an error message pointing ...

What is the reason behind the restriction on using capital letters in React project names?

When attempting to create a new project "newRecipeApp" in React, I encountered the following message: npx: installed 91 in 29.359s Could not create a project called "newRecipeApp" because of npm naming restrictions: * name can no longer contain capital ...