Search code examples
javascriptnode.jsnpmjspm

JSPM private registry configuration


I am using Verdaccio to host a private package. I want to use this package in a project that I am working on locally. I have my package successfully published up to Verdaccio running on localhost (http://localhost:4873)

I am having trouble getting jspm to find this package when I run jspm install. I incremented the package version number when I published to verdaccio, and in my package.json of my local project I have also made the same version upgrade. My ~/.npmrc file contains:

registry=https://npm.123-456.io
@myScope:registry=http://localhost:4873

I have tried using scoping here. I am using jspm install to install my packages. My package.json cotanins:

.
.
.
.
"jspm": {
"directories": {
  "baseURL": "src",
  "test": "test"
},
"configFile": "src/system.config.js",
"dependencies": {
  "myPackage": "npm:@myScope/[email protected]",
  .
  .
  .
  }
}

When I run npm install [email protected] (which is the version that is only contained on Verdaccio) it installs. However, jspm install results in the following:

err  Repo npm:@myScope/myPackage not found!

Do I need the scoping here? How can I make sure that when using jspm install that it actually finds my package hosted on Verdaccio?


Solution

  • I have resolved the problem. When publishing the package, the package.json needed to contain the scope as well.

     "name": "@myScope/myPackage"
    

    Simply publishing the package without the @myScope prefix, even with a new version number, was not enough for my project to locate the package from my private registry. The scope needed to be included.