NPM Publish

How to troubleshoot NPM problems

AuthorFullName__c
Patrick Russell
articleNumber
000004147
ft:sourceType
Salesforce
FirstPublishedDate
2018-11-13T23:41:52Z
lastModifiedDate
2021-09-27
VersionNumber
11
To publish npm packages to Artifactory, you'll need to configure your package.json to point to your Artifactory npm repository:
{
  "name": "test-package",
  "version": "0.0.16",
  "description": "hahahahah",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "Pat",
  "license": "ISC",
  "publishConfig": {
    "registry": "http://localhost:8081/artifactory/api/npm/npm/"
  },
  "dependencies": {
    "angular": "^1.6.4",
    "busybox": "^2017.3.22",
    "clone": "^2.1.1",
    "uglify-js": "^2.7.5"
  },
  "devDependencies": {},
  "maintainers" : [
    {"name":"jimmy", "email":"jim@jimmy.com"},
    {"name":"Frank","email":"frank@west.com"}]
}

After doing so, you can run npm publish to deploy a .tar.gz file to the local repository:
npm publish

[request.log]
20180524084923|96|REQUEST|127.0.0.1|admin|PUT|/api/npm/npm/test-package|HTTP/1.1|201|1695
 

Here is an example curl command which simulates a publish. You need to manually download an NPM .tar.gz file for this command to work:
curl -XPUT -u admin -T test-package-1.0.tgz http://<artifactory.com>/artifactory/api/npm/npm-local/test-package​​​​​​​