2

I have created an NPM package like so - (https://github.com/fyndreact/nitrozen)

I'm able to successfully publish the package on github (https://npm.pkg.github.com/) However, what I want to do is publish it on NPM registry.

I'm not able to see the package in the NPM registry https://www.npmjs.com/

Thing's I have already tried doing:

Login & publish NPM commands

  1. NPM login
  2. NPM publish --access=public

Removing the following publishConfig from package.json and publishing it.

   "registry": "https://npm.pkg.github.com/fyndreact",
   "access": "public"
 } 

After running the NPM publish command, I'm able to see this

npm notice === Tarball Details === 
npm notice name:          @fyndreact/nitrozen                     
npm notice version:       2.2.6                                   
npm notice filename:      @fyndreact/nitrozen-2.2.6.tgz           
npm notice package size:  223.2 kB                                
npm notice unpacked size: 3.0 MB                                  
npm notice shasum:        4eac8e8aea03c5d085a5814e536fd42c24f15c40
npm notice integrity:     sha512-/8cTfavmOVDd9[...]AY8b3mFWHkTOQ==
npm notice total files:   207                                     
npm notice 
npm notice Publishing to https://npm.pkg.github.com/

How do I publish the package to NPM registry (https://www.npmjs.com/) instead of github registry (https://npm.pkg.github.com) ? I'm not able to figure out what I'm doing wrong.

package.json

{
  "name": "@fyndreact/nitrozen",
  "version": "2.2.7",
  "description": "React component library inspired by Nitrozen",
  "private": false,
  "scripts": {
    "rollup": "rollup -c",
    "test": "jest",
    "test:coverage": "npm test -- --coverage",
    "storybook": "start-storybook -p 6006",
    "build-storybook": "build-storybook -o docs",
    "lint:check": "prettier --check .",
    "lint:format": "prettier --write .",
    "prepare": "husky install"
  },
  "lint-staged": {
    "*.{js,jsx,ts,tsx}": "eslint --fix",
    "*.{css,scss,sass}": "stylelint --fix",
    "**/*": "prettier -w -u"
  },
  "author": "Fynd Opex frontend",
  "license": "ISC",
  "devDependencies": {
    "@mdx-js/react": "^2.1.3",
    "@rollup/plugin-commonjs": "^22.0.2",
    "@rollup/plugin-image": "^2.1.1",
    "@rollup/plugin-node-resolve": "^14.1.0",
    "@rollup/plugin-typescript": "^8.5.0",
    "@storybook/addon-actions": "^6.5.12",
    "@storybook/addon-essentials": "^6.5.12",
    "@storybook/addon-interactions": "^6.5.12",
    "@storybook/addon-links": "^6.5.12",
    "@storybook/addons": "^6.5.12",
    "@storybook/builder-webpack5": "^6.5.12",
    "@storybook/manager-webpack5": "^6.5.12",
    "@storybook/preset-scss": "^1.0.3",
    "@storybook/react": "^6.5.12",
    "@storybook/testing-library": "^0.0.13",
    "@storybook/theming": "^6.5.12",
    "@testing-library/jest-dom": "^5.16.5",
    "@testing-library/react": "^13.4.0",
    "@types/jest": "^29.0.3",
    "@types/react": "^18.0.20",
    "babel-loader": "^8.2.5",
    "css-loader": "^6.7.1",
    "husky": "^8.0.1",
    "identity-obj-proxy": "^3.0.0",
    "jest": "^29.0.3",
    "postcss": "^8.4.16",
    "pretty-quick": "^3.1.3",
    "rollup": "^2.79.0",
    "rollup-plugin-copy": "^3.4.0",
    "rollup-plugin-dts": "^4.2.2",
    "rollup-plugin-less": "^1.1.3",
    "sass": "^1.54.9",
    "sass-loader": "^13.0.2",
    "style-loader": "^3.3.1",
    "ts-jest": "^29.0.1",
    "typescript": "^4.8.3"
  },
  "main": "dist/cjs/index.js",
  "module": "dist/esm/index.js",
  "files": [
    "dist"
  ],
  "types": "dist/index.d.ts",
  "dependencies": {
    "@babel/core": "^7.19.1",
    "@babel/preset-env": "^7.19.1",
    "@babel/preset-react": "^7.18.6",
    "@babel/preset-typescript": "^7.18.6",
    "@types/jest": "^29.0.3",
    "@types/react": "^18.0.20",
    "autoprefixer": "^10.4.11",
    "babel-jest": "^29.0.3",
    "classnames": "^2.3.2",
    "jest-environment-jsdom": "^29.0.3",
    "less": "^4.1.3",
    "node-sass": "^7.0.3",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "rollup-plugin-img": "^1.1.0",
    "rollup-plugin-postcss": "^4.0.2",
    "tslib": "^2.4.0"
  },
  "publishConfig": {
    "registry": "https://registry.npmjs.org/",
    "access": "public"
  }
}

1 Answer 1

2

Everything is fine but you need to change the below code in publishConfig

 "publishConfig": {
    "registry": "https://registry.npmjs.org/",
    "access": "public"
  },

Ref:https://docs.npmjs.com/cli/v8/using-npm/registry

Sign up to request clarification or add additional context in comments.

5 Comments

Even after adding this in package.json, it is still publishing to npm.pkg.github.com
can you share the me package.json file
If you see these lines @OWNER:registry=npm.pkg.github.com remove that and remove the npm user login again
I have edited the question & added the package.json now. These lines @OWNER:registry=npm.pkg.github.com are not there anywhere in the project anymore
Did you check the .npmrc file?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.