question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

configuration update to remove caret from all the packages

See original GitHub issue

Current Behavior

When doing a release now, all the packages currently have the ^ (caret) in front of them. The problem with this is let’s say I released two versions 6.21.0 and 6.22.0 (shown below), I was to use 6.21.0 I will get all the “latest” dependencies of packageA, packageB, and packageC because I have the ^ infront of all the packages. . I want to be able to lock the versions per release.

Release 1

{
   "version": "6.21.0",
   .
   .
   "dependencies": {
       "packageA": "^1.2.3",
       "packageB": "^2.6.11",
       "packageC": "^1.2.5"
   }
}

Release 2

{
   "version": "6.22.0",
   .
   .
   "dependencies": {
       "packageA": "^1.3.0",
       "packageB": "^2.6.12",
       "packageC": "^1.3.0"
   }
}

Possible Solution

Remove the ^ caret in front of the packages to lock. Are there any configurations I can update to help resolve it?

{
   "version": "6.21.0",
   .
   .
   "dependencies": {
       "packageA": "1.2.3",
       "packageB": "2.6.11",
       "packageC": "1.2.5"
   }
}

Your Environment

Executable Version
lerna --version 3.4.1
npm --version 6.14.6
node --version 10.22.0
OS Version
NAME VERSION
macOS Sierra 10.15.7
–>

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:8

github_iconTop GitHub Comments

3reactions
fdesforgescommented, Mar 9, 2021

I was running on quite the same issue :

I’m already using --exact for the version command, and all my package.json of my monorepo doesn’t contains any ^.

But my published package.json of all the packages of the monorepo contains ^, and it make possible issue when project using those dependencies use npm i.

After reading you issue, i try the following that it is not documented here : https://github.com/lerna/lerna/tree/main/commands/publish

lerna publish --exact 

and it’s work : all my packages are as expect with no carret on my registry and inside the package.lock of the consumer of those dependencies.

So if you have the same need, you can try this.

edit : you can find some information about it in the test https://github.com/lerna/lerna/blob/2d0a97aade2b17cb58ce8c0afdbfd950033f46db/commands/publish/__tests__/publish-relative-file-specifiers.test.js

1reaction
KATTcommented, Oct 19, 2021

I tried with --exact here, and it seems to work really well.

The only problem I have now is that I also have an examples/ folder with reference projects where I do want the caret 🥕 . 😅

I.e. I want to run lerna publish and have

  • All my examples/ being^x.y.z
  • All my packages/ being x.y.z

Any ideas on workarounds?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does `npm install` add / remove caret (^) to / from version ...
Edit: According to the discussion in issue #20434 this occurs by design using npm >=6.0.0 . Why does this happen?
Read more >
Semver explained - why is there a caret (^) in my package.json?
Configuring npm defaults. The default behavior in npm is to use caret (^) when updating package.json. This default behavior can be configured with....
Read more >
Defining Dependency Versions in package.json
The caret indicates that the minor version of a dependency can be auto updated the next time npm install is run for the...
Read more >
A Short Introduction to the caret Package
The package utilizes a number of R packages but tries not to load them all at package start-up (by removing formal package dependencies,...
Read more >
4 safe steps to update NPM packages [Cheat Sheet]
An example of npm packages that are listed as dependencies in the package.json file. All dependencies have a caret (^) in front, showing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found