Gitlab.company.com - npm publish giving error (need auth This command requires you to be logged in to)

Hi All,

I am little new in gitlab.com here so please ignore my silly questions if any.

I have created my plain vanilla javascript lib. Now I want to publish it in Gitlab package registry. I have set up all possible steps given in document, but still getting error as below

Replace actual value with dummy values as below.

  • project_Id = 'someId'
  • company_Name = 'someCompany'
  • package_Library_name = 'somePackage'
npm ERR! need auth This command requires you to be logged in to  https://gitlab.company_Name.com/api/v4/projects/project_Id/packages/npm/
npm ERR! need auth You need to authorize this machine using `npm adduser`
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Windows\system32\config\systemprofile\AppData\Local\npm-cache\_logs\2022-04-11T04_58_13_146Z-debug-0.log
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit status 1

My Package.JSON

{
  "name": "@atul.dawkhare/package_Library_name",
  "version": "1.0.0",
  "publishConfig": {
    "@atul.dawkhare:registry":" https://gitlab.company_Name.com/api/v4/projects/project_Id/packages/npm/"
  },
  "description": "UI component library created using web components with the Atomic Design approach.",
  "scripts": {
    "test": "web-test-runner \"./stories/**/*.test.js\" --node-resolve",
    "storybook": "start-storybook -p 6006",
    "build-storybook": "build-storybook",
    "build": "rollup -c",
    "prepublishOnly": "npm install && npm run build",
    "pack:dev": "rollup -c && npm pack && move *.tgz node_modules_offline/"
  },
  "repository": {
    "type": "git",
    "url": "https://gitlab.company_Name.com/ui-practice/package_Library_name.git"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@babel/core": "^7.17.7",
    "@babel/plugin-proposal-class-properties": "^7.16.7",
    "@babel/plugin-proposal-decorators": "^7.17.2",
    "@babel/plugin-proposal-export-default-from": "^7.16.7",
    "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7",
    "@babel/plugin-proposal-object-rest-spread": "^7.17.3",
    "@babel/plugin-proposal-optional-chaining": "^7.16.7",
    "@babel/plugin-proposal-private-methods": "^7.16.11",
    "@babel/plugin-syntax-dynamic-import": "^7.8.3",
    "@babel/plugin-transform-arrow-functions": "^7.16.7",
    "@babel/plugin-transform-block-scoping": "^7.16.7",
    "@babel/plugin-transform-classes": "^7.16.7",
    "@babel/plugin-transform-destructuring": "^7.17.7",
    "@babel/plugin-transform-for-of": "^7.16.7",
    "@babel/plugin-transform-parameters": "^7.16.7",
    "@babel/plugin-transform-shorthand-properties": "^7.16.7",
    "@babel/plugin-transform-spread": "^7.16.7",
    "@babel/preset-env": "^7.16.11",
    "@babel/preset-typescript": "^7.16.7",
    "@rollup/plugin-commonjs": "^21.0.2",
    "@rollup/plugin-node-resolve": "^13.1.3",
    "@rollup/plugin-typescript": "^8.3.1",
    "@storybook/addon-a11y": "^6.4.19",
    "@storybook/addon-actions": "^6.4.19",
    "@storybook/addon-essentials": "^6.4.19",
    "@storybook/addon-links": "^6.4.19",
    "@storybook/addons": "^6.4.19",
    "@storybook/preset-scss": "^1.0.3",
    "@storybook/theming": "^6.4.19",
    "@storybook/web-components": "^6.4.19",
    "@web/test-runner": "^0.13.27",
    "babel-loader": "^8.2.3",
    "babel-plugin-macros": "^3.1.0",
    "babel-plugin-polyfill-corejs3": "^0.5.2",
    "core-js": "^3.21.1",
    "css-loader": "^5.2.7",
    "eslint": "^8.11.0",
    "rollup": "^2.70.1",
    "rollup-plugin-dts": "^4.2.0",
    "rollup-plugin-scss": "^2.6.1",
    "sass": "^1.49.9",
    "sass-loader": "^10.1.1",
    "storybook-dark-mode": "^1.0.9",
    "style-loader": "^2.0.0"
  },
  "main": "build/cjs/index",
  "module": "build/esm/index",
  "files": [
    "build"
  ],
  "dependencies": {
    "@esm-bundle/chai": "^4.3.4-fix.0",
    "i18next": "^21.6.14",
    "lit-html": "^2.2.0",
    "node-sass": "^6.0.1",
    "rollup-plugin-peer-deps-external": "^2.2.4"
  }
}

My .npmrc file

@atul.dawkhare:registry https://gitlab.company_Name.com/api/v4/npm/
//gitlab.company_Name.com/api/v4/projects/:_authToken=${CI_JOB_TOKEN}
//gitlab.company_Name.com/api/v4/packages/npm/:_authToken=${CI_JOB_TOKEN}
//gitlab.company_Name.com/api/v4/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=${CI_JOB_TOKEN}
Assignee Loading
Time tracking Loading