NPM 8 workspaces - Install one package as the dependency for another package in monorepo - npm

Say I have the following structure
packages
- #my-scope/packageA
- #my-scope/packageB
- #my-scope/packageC
Let's say I want to install packageA as a dependency of packageB. With NPM 8 workspaces I would think this ought to do it:
npm install #my-scope/packageA --workspace=#my-scope/packageB
Instead I get this:
npm ERR! 404 Not Found - GET https://registry.npmjs.org/#my-scope%2fpackageA - Not found
npm ERR! 404
npm ERR! 404 '#my-scope/packageA#*' is not in this 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.
Clearly it is trying to get it from the registry (and no, I haven't published yet, not ready) but I want it to recognize that this dependency is in my project as a workspace. Anyone know why this might be happening? I haven't found many good resources explaining how to install dependencies from inside your monorepo (I don't even know what those are called...).

The problem you are facing has been reported as a bug: https://github.com/npm/cli/issues/3637
It has been marked as fixed.
Please try to install the latest version of npm (8.8.0 as of this writing) and see if your problem has been resolved.

Related

Can't install packages using "npm install"

I am new to React native, javascript.
I am trying to install packages using npm install.
But I can't install anything. All the time I get the same error:
npm install #tensorflow/tfjs
npm ERR! 404 Object Not Found - GET https://skimdb.npmjs.com/registry/form-data/-/form-data-
3.0.1.tgz - not_found
npm ERR! 404
npm ERR! 404 'form-data#https://skimdb.npmjs.com/registry/form-data/-/form-data-3.0.1.tgz' is
not in this 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.
Try this setting :
npm config set registry http://registry.npmjs.org
Yeah so depending on your correlative, there might be somethings wrong with your node in general,
you could try using
yarn
yarn add #tensorflow/tfjs

How to update a published npm package?

I recently joined a team and updated an already existing react native plugin that was published on npm. Now I want to update the package on npm.
I've tried the command
npm publish
but I get these errors:
npm ERR! code E404
npm ERR! 404 Not Found - PUT https://registry.npmjs.org/myplugin - Not found
npm ERR! 404
npm ERR! 404 'myplugin#3.5.0' 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.
I use my browser for the link https://registry.npmjs.org/myplugin and it's working properly.
I have pushed the latest updated version on git so everything is OK on GitHub.
I have a npm account and I'm an admin in the organization account. Any guidance on how I can update the package on npm will be much appreciated.
I just logged in to my account in npm and that solved my problem.

Published a NPM package to Azure Artifacts but getting this error while installing

F:\angular library\sampleangular>npm install examplepackage#0.0.1
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/examplepackage- Not found
npm ERR! 404
npm ERR! 404 'examplepackage#0.0.1' 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! C:\Users\jack\AppData\Roaming\npm-cache_logs\2020-03-03T06_07_13_338Z-debug.log
We have the same error (E404). The root cause turned out, is because we have multiple registry sources. One is our own registry and the other is public registry (registry.npmjs.org)
To resolve this, we added both registries in the .npmrc file (can be in either user's .npmrc or the project .npmrc).
We append the following lines in the .npmrc file.
#contosoPrivateFeed:registry=https://contoso.pkgs.visualstudio.com/_packaging/Contoso.Feed/npm/registry/
registry=https://registry.npmjs.org
Also worth to mention, we don't have Upstream setup in our Azure DevOps feed.
Specifying multiple registries allow npm commands to use the registries. Thus, no need to setup Upstream sources.
After some tests, we think your issue may be related to the UpStream source in Azure devops feed settings.
Here's some info when I do the test:
nest is package from default npm packages. When i deleted the npm upstream source, I got the same error when running command npm install nest. After that I added the NPM public source(npmjs) as one upstream sources in feed settings, then it worked when I ran the command the second time.
So you need to add npmjs as Upstream source of your current feed. Hope it helps :)

npm install fails with 'error-ex#^1.3.1' is not in the npm registry

npm install fails with the following error:
⠼ Installing packages...npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/error-ex
npm ERR! 404
npm ERR! 404 'error-ex#^1.3.1' 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 It was specified as a dependency of 'parse-json'
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
Well I don't know how to add this additional info, since I can't comment due to not having 50 reputation and my edit to the question with this details was rejected by the community with the message
This edit was intended to address the author of the post and makes no sense as an edit. It should have been written as a comment or an answer.
Visting https://registry.npmjs.org/error-ex & https://registry.npmjs.com/error-ex gives a cloudflare 404 error page.
Visiting the npm registry mirror at https://skimdb.npmjs.com/error-ex gives a json response but since the tarball links are from https://registry.npmjs.org/ npm install after setting the registry to the mirror fails with a cloudflare 404 for the url https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz
Tried with a couple of internet connections since the problem seems to be something with cloudflare. One of the internet connections I tried gave me the proper json response when tried via browser and wget. But still npm install failed.
Finally got it working by manually downloading the above tarball with the internet connection that gave me the proper result and then adding it to the npm cache by
npm cache add <link_to_the_tarball>
Note: Though this fixed this specific issue. There were other packages with the same issue. So, finally I ended up installing npm_lazy(http://mixu.net/npm_lazy/) to use as my repository. Manually added the failing item like error-ex to the npm_lazy cache by editing the json file.

Kendo Angular 2 controls not in npm registry on XAML build

Started using angular2 with .NET Core and I'm trying to get continuous integration going on the build servers.
We are running TFS2013 so it's a XAML build definition. Since I don't want the node_modules folder checked in to source control, I'm attempting to run npm install in a powershell script before the build starts.
When I do this I get the following
npm ERR! 404 Not found : #progress/kendo-angular-dropdowns npm ERR!
404 npm ERR! 404 '#progress/kendo-angular-dropdowns' 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 It was specified as a
dependency of 'angular2-webpack' npm ERR! 404 npm ERR! 404 Note that
you can also install from a npm ERR! 404 tarball, folder, http url,
or git url.
On Telerik's site they say you need to enable the NPM registry by running this in the console
npm login --registry=https://registry.npm.telerik.com/ --scope=#progress
This requires you to provide account details though.
I've done this on the build server and I'm able to run npm install successfully from the command line, but no such luck when attempting it from the powershell script in MSBuild.
Any help would be greatly appreciated.
The error is most likely caused by the registry not available to the build script.
Make sure that there is a .npmrc file that specifies the registry and the auth token, not unlike this:
#progress:registry=https://registry.npm.telerik.com/
//registry.npm.telerik.com/:_authToken=long_secret_token_here
... and that the file is honored by MsBuild.