Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rush add -p is does not see local package #1469

Closed
1 of 2 tasks
Jabher opened this issue Aug 19, 2019 · 7 comments
Closed
1 of 2 tasks

Rush add -p is does not see local package #1469

Jabher opened this issue Aug 19, 2019 · 7 comments
Labels
bug Something isn't working as intended effort: easy Probably a quick fix. Want to contribute? :-) help wanted If you're looking to contribute, this issue is a good place to start!

Comments

@Jabher
Copy link
Contributor

Jabher commented Aug 19, 2019

Please prefix the issue title with the project name i.e. [rush], [api-extractor] etc.

Is this a feature or a bug?

  • Feature
  • Bug

Please describe the actual behavior.

  1. I creates empty rush monorepo
  2. I add 2 separate packages (a,b) without publishing any of them
  3. I run rush add -p b in package a
  4. I encounter the following error
jabher-osx:<PATH> jabher$ rush add -p <B>
Your version of Node.js (12.8.1) has not been tested with this release of Rush. The Rush team will not accept issue reports for it. Please consider upgrading Rush or downgrading Node.js.
Found configuration in <PATH>/rush.json


Rush Multi-Project Build Tool 5.9.1 - https://rushjs.io

Found configuration in <PATH>/rush.json

Starting "rush add"

Determining new version for dependency: <B>
No version selector was specified, so the version will be determined automatically.

The "ensureConsistentVersions" policy is NOT active, so we will assign the latest version.

Querying NPM registry for latest version of "<B>"...

ERROR: The command failed with exit code 1
npm ERR! code E404
npm ERR! 404 '<B>' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it
npm ERR! 404 (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! 404 
npm ERR! 404  '<B>@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR!     <$PATH>/.npm/_logs/2019-08-19T08_12_51_250Z-debug.log

What is the expected behavior?
local package is discovered

If this is a bug, please provide the tool version, Node.js version, and OS.

  • Tool:
  • Tool Version:
    5.9.1
  • Node Version:
    v12.8.1
    • Is this a LTS version?
      No
    • Have you tested on a LTS version?
      No
  • OS:
    Mac OS X 10.14.6
@halfnibble
Copy link
Contributor

Is project b listed in your rush.json file under projects?

@rakeshpatnaik rakeshpatnaik added the bug Something isn't working as intended label Aug 19, 2019
@iclanton iclanton added effort: easy Probably a quick fix. Want to contribute? :-) help wanted If you're looking to contribute, this issue is a good place to start! labels Aug 19, 2019
@iclanton
Copy link
Member

I'm seeing this issue too. I suspect this is a regression.

@halfnibble
Copy link
Contributor

halfnibble commented Aug 19, 2019

I have a minimal repro handy.
https://github.com/halfnibble/newmono

Reproduce with
$ cd apps/projectA
$ rush add -p project-b

@halfnibble
Copy link
Contributor

Ah ha! I figured out why it was working for me earlier. Apparently, it works if the folder name is the same as the project name—or doesn't contain special characters. Or at least it does in this minimal repro of rush add -p working:
https://github.com/halfnibble/newmono_working

Reproduce with
$ cd apps/projecta
$ rush add -p projectb

@VincentSurelle
Copy link
Contributor

VincentSurelle commented Oct 22, 2019

@halfnibble Oh great, I understand now why I'm having troubles with local dependencies.
It never worked for me but I think that's because I'm using private npm with scope.

With this behavior sending @scope/package-name in npm and using local dependencies in Rush is still possible ?

Edit : Just thought that the best practice when containerizing my apps may be to cp -L instead of re-installing dependencies from npm ? 🙄

@halfnibble
Copy link
Contributor

My repros are not so insightful after all. It turns out that rush add -p projectb worked because "projectb" is in the npm registry. (Thank you @Claudiazhaoya for discovering this).

@VincentSurelle about not reinstalling packages from npm, if your local projects are in the rush.json config file, and the versions can be satisfied by the local project, then Rush will symlink your local project automatically. The problem, that you reported on in issue #991, is that we get an error for unpublished projects.

In fact, I think this issue is a duplicate of #991. Therefore, I am closing it in favor of #991, which has more accurate information. Please reopen if you think this is incorrect.

@dtinth
Copy link
Contributor

dtinth commented Oct 14, 2021

I found this issue by googling for "is not in the npm registry, or you have no permission to fetch it."

The key part is this phrase from the above comment: “versions can be satisfied by the local project”.

In my case,

  • cli/package.json

    { "name": "@my/cli", "dependencies": { "@my/lib": "*" } }
  • lib/package.json

    // ❌ Does not work; missing version
    { "name": "@my/lib" }
    
    // ❌ Does not work; prereleases are not selectable by "*"
    { "name": "@my/lib", "version": "0.1.0-0" }
    
    // ✅ Works
    { "name": "@my/lib", "version": "0.1.0" }

@iclanton iclanton moved this to Closed in Bug Triage Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as intended effort: easy Probably a quick fix. Want to contribute? :-) help wanted If you're looking to contribute, this issue is a good place to start!
Projects
Archived in project
Development

No branches or pull requests

6 participants