403 Forbiden when publish module to npm - node.js

I tried to publish a module but always get an error. Please help to check
This is my error
npm notice
npm notice 📦 remove-null#1.0.0
npm notice === Tarball Contents ===
npm notice 435B index.js
npm notice 178B package.json
npm notice === Tarball Details ===
npm notice name: remove-null
npm notice version: 1.0.0
npm notice package size: 467 B
npm notice unpacked size: 613 B
npm notice shasum: be0e9f07c9f43c01959de7b5a623d9be6c358aba
npm notice integrity: sha512-vXiTrxXk5H0sf[...]Cqo3wBwnLX1Lg==
npm notice total files: 2
npm notice
npm ERR! code E403
npm ERR! 403 403 Forbidden - PUT https://registry.npmjs.org/remove-null - Forbidden
npm ERR! 403 In most cases, you or one of your dependencies are requesting
npm ERR! 403 a package version that is forbidden by your security policy.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/dungva/.npm/_logs/2021-01-26T04_11_35_573Z-debug.log

create an organization.
enter image description here
invite a member, such as yourself.
login the email of the member, accept and verify the invitation above.
npm login and publish your module.

Related

npm publish to registry.npmjs.org fails in GitLab CI

I tried to publish in registry.npmjs.org/ with gitlab ci, but instead of publish, i get an error
I tried what this page says https://webbureaucrat.gitlab.io/posts/continuously-deploying-an-npm-package-with-gitlab-ci-cd/
with this gitlab-ci.yml file
image: node:latest
stages:
- deploy
deploy:
stage: deploy
script:
- echo "//registry.npmjs.org/:_authToken=${NPMJS_TOKEN}" > .npmrc
- npm publish
But I get the next error
npm notice
npm ERR! code ENEEDAUTH
npm ERR! need auth This command requires you to be logged in to https://registry.npmjs.org/
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:\
I tried to change by this but I have the same output
- npm config set //registry.npmjs.org/:_authToken ${NPMJS_TOKEN}
I thought I would fixed something when i did this because the error message changes
- npm config set //registry.npmjs.org/:_authToken ${NPMJS_TOKEN}
npm notice
npm notice Publishing to https://registry.npmjs.org/
npm ERR! code E404
npm ERR! 404 Not Found - PUT https://registry.npmjs.org/xxxx - Not found
npm ERR! 404
npm ERR! 404 'xxxx#1.0.0' is not in this registry.
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:
But I couldn't go any further than here, the funny thing is if i go to this link https://registry.npmjs.org/xxxx after i published local, this results something by HTTP get by browser, but still show the same message, even if I increase the version
The only way i can have same error doing a local publish was doing npm publish after i delete the package, i had to change the package name to publish again (this doesn't work in gitlab)

Angular npm link throws 404 while linking local dependency lib

As the title says, creating a link with the dependency (it shows inside my global node folder). However I am using nvm-windows which creates separate folders fore each version which may cause some issues but reading about this issue the env var NVM_SYMLINKS used to fix this.
Env variables contains NVM_SYMLINKS and it points to a nodejs installation at my main drive which according to other issues is fine.
$ npm start
> own-webpage#0.0.0 start C:\PROJECTS\HMR\HKIR\hkir\hmr\bo\frontend
> npm link lib-hkir-common-client-bo && ng serve
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/lib-hkir-common-client-bo - Not found
npm ERR! 404
npm ERR! 404 'lib-hkir-common-client-bo#latest' 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\WORKSTATION\AppData\Roaming\npm-cache\_logs\2022-03-28T09_39_51_833Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! own-webpage#0.0.0 start: `npm link lib-hkir-common-client-bo && ng serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the own-webpage#0.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\WORKSTATION\AppData\Roaming\npm-cache\_logs\2022-03-28T09_39_51_877Z-debug.log
Running node -v in both directories shows that both of them are using the same versions.
I've tried deleting both node_modules, package-locks, removing the smylink from the main global recreating said symlink. But nothing seems to work.
When creating the link via npm link inside the dependency it prints out the following symlink pattern:C:\Program Files\nodejs\node_modules\lib.hkir.common.client.bo -> C:\PROJECTS\HMR\HKIR\hkir\lib.hkir.common.client.bo which once again according to others is completely fine.
How can I fix the issue so my project sees and uses the linked dependency?
Thanks.

How to Push NPM Package to Azure Artifact Feed?

By mistake, I have deleted an NPM Package from Azure Artifact Feed and then deleted it from Recyclebin also. Now while trying to push the NPM package back to Azure Artifact Feed, I am getting the below error message. How do I push the same package again to Artifact Feed?
> npm --registry https://pkgs.dev.azure.com/maryodavid0305/Platform/_packaging/test/npm/registry/ publish jdmessenger-1.0.0.tgz
npm notice
npm notice package: #jd-libs/jdmessenger#1.0.0
npm notice === Tarball Contents ===
npm notice 2.1kB dist/cjs/events.js
npm notice 938B dist/esm/events.js
npm notice 5.2kB dist/cjs/executor.js
npm notice 4.0kB dist/esm/executor.js
npm notice 712B dist/cjs/index.js
npm notice 87B dist/esm/index.js
npm notice 1.9kB package.json
npm notice 1.0kB dist/cjs/events.js.map
npm notice 975B dist/esm/events.js.map
npm notice 3.4kB dist/cjs/executor.js.map
npm notice 3.4kB dist/esm/executor.js.map
npm notice 141B dist/cjs/index.js.map
npm notice 145B dist/esm/index.js.map
npm notice 602B README.md
npm notice 1.0kB dist/cjs/events.d.ts
npm notice 1.0kB dist/esm/events.d.ts
npm notice 1.9kB src/tests/events.spec.ts
npm notice 1.7kB src/events.ts
npm notice 1.3kB dist/cjs/executor.d.ts
npm notice 1.3kB dist/esm/executor.d.ts
npm notice 5.2kB src/tests/executor.spec.ts
npm notice 5.8kB src/executor.ts
npm notice 54B dist/cjs/index.d.ts
npm notice 54B dist/esm/index.d.ts
npm notice 54B src/index.ts
npm notice === Tarball Details ===
npm notice name: #jd-libs/jdmessenger
npm notice version: 1.0.0
npm notice package size: 8.8 kB
npm notice unpacked size: 44.1 kB
npm notice shasum: 294b8c616c6a846d1b5ef72fca3df4412c1830d4
npm notice integrity: sha512-3Q3rsjeOMUms7[...]NVf6QC56tHDyw==
npm notice total files: 25
npm notice
npm ERR! code E403
npm ERR! 403 403 Forbidden - The version 1.0.0 of #jd-libs/jdmessenger has been deleted. It cannot be restored or pushed. (DevOps Activity ID: 54385895-A886-4BB4-A948-AF65CEE0F8A7) - PUT https://pkgs.dev.azure.com/maryodavid0305/Platform/_packaging/test/npm/registry/#jd-libs%2fjdmessenger - The version 1.0.0 of #jd-libs/jdmessenger has been deleted. It cannot be restored or pushed.
npm ERR! 403 In most cases, you or one of your dependencies are requesting
npm ERR! 403 a package version that is forbidden by your security policy.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\maryo\AppData\Roaming\npm-cache\_logs\2022-02-09T09_50_24_857Z-debug.log
The only way to do this, as I know, is pushing another version.
If possible, upgrade version number, i.e. 1.0.1, and push it.

npm ERR! code E404 npm ERR! 404 Not Found - GET https://registry.npmjs.org/easier-discordjs - Not found

Hello im making my first npm package called easier-discordjs but when i do npm link in my main module folder and in my test module folder it gives an error.
npm link easier-discordjs
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/easier-discordjs - Not found
npm ERR! 404 'easier-discordjs#*' 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\niels\AppData\Local\npm-cache\_logs\2021-06-22T15_59_17_982Z-debug.log
My index.js for my main module is this:
module.exports = (name) => {
return `Hello ${name}!`;
};
My index.js for my test module is this:
const greeter = require('easier-discordjs');
console.log(greeter('Niels'))
I don't know what to do.
As said in the NPM docs, you must first execute the command npm link in easier-discordjs project folder and then execute npm link easier-discordjs in your test project.
MrNossiom

Protractor Error - #types/jasmine' is not in the npm registry

I am trying to install protractor but receiving following error.
command:
npm install -g protractor
npm ERR! node v4.4.3
npm ERR! npm v2.15.1
npm ERR! code E404
npm ERR! 404 no such package available : #types/jasmine
npm ERR! 404
npm ERR! 404 '#types/jasmine' 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 'protractor'
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! Please include the following file with any support request:
npm ERR! F:\temp\chrome downloads\npm-debug.log
I came across this issue today and my problem was that I had set a custom registry within the npm config file. Have you ever used "npm set registry"?
If so, you can manually tell npm where to look for the '#types' registry with the following command:
npm config set #types:registry https://registry.npmjs.org/
The problem is coming from the fact that you're using a private registry that has not yet added support for #organization packages.
In my case, I was using Sonatype Nexus and my version didn't have support for those types of packages. #Willie Valdez's suggestion is probably the best solution for you, right now.
Also, check if you have a .npmrc file in your home directory or in your project directory. The registry might be there. If that's the case, just rename the file to npmrc_bak or something else until you install the package and then revert back to its original name.
You can also include a .npmrc file in your current project with the below details:
#angular:registry=https://registry.npmjs.org
#types:registry=https://registry.npmjs.org
#ngtools:registry=https://registry.npmjs.org
#angular-cli:registry=https://registry.npmjs.org
its handy and resuable across new projects.

Resources