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.
Related
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.
I've been going through the nightmare that is trying to get lerna to publish in my ci pipeline.
I've managed to have the scripts pull from git to check tags and I've found the withNPM pipeline plugin. Because I'm using lerna to publish multiple packages I have to move the .npmrc file that the plugin creates in the workspace to the root of the the home directory so that all packages can access it.
The NPM plugin uses the jenkins config file to create the .npmrc file. Which looks like this:
//registry.npmjs.com/:_authToken=TOKEN
Here is what I have in my Jenkins pipeline.
stage('lerna publish') {
steps {
withCredentials([sshUserPrivateKey(credentialsId: 'cb8acd82-3a50-4a94-9d5f-44b04856e6fd', keyFileVariable: 'GITHUB_KEY')]) {
sh 'echo ssh -i $GITHUB_KEY -l git -o StrictHostKeyChecking=no \\"\\$#\\" > ./run_ssh.sh'
sh 'chmod +x ./run_ssh.sh'
withEnv(['GIT_SSH=./run_ssh.sh']) {
withNPM(npmrcConfig: 'da4e5199-b04b-41b6-a03f-dfbcc344f701') {
sh "rm -rf ~/.npmrc"
sh 'mv ./.npmrc ~/.npmrc'
sh 'npm config set registry https://registry.npmjs.com/'
sh 'git config --global user.email "thomas#reggi.com"'
sh 'git config --global user.name "reggi"'
sh 'git checkout master'
sh 'git pull origin master --force'
sh 'npm run lerna-publish'
}
}
}
}
}
Here's the error:
lerna info auto-confirmed
lerna info publish Publishing packages to npm...
lerna ERR! npm publish --ignore-scripts exited 1 in '#reggi/help.filter-until'
lerna ERR! npm publish --ignore-scripts stderr:
npm notice
npm notice package: #reggi/help.filter-until#0.0.20
npm notice === Tarball Contents ===
npm notice 1.5kB package.json
npm notice 609B index.build.js
npm notice === Tarball Details ===
npm notice name: #reggi/help.filter-until
npm notice version: 0.0.20
npm notice package size: 997 B
npm notice unpacked size: 2.1 kB
npm notice shasum: a6db6d4dc02f05548c22fe2e034832ac02252633
npm notice integrity: sha512-6oAFaXqZMREsh[...]GnMcnIxXUBINg==
npm notice total files: 2
npm notice
npm ERR! code ENEEDAUTH
npm ERR! need auth auth required for publishing
npm ERR! need auth You need to authorize this machine using `npm adduser`
I found I wasn't being consistent with the urls above and changed them both to .com and now I'm getting this issue:
lerna info auto-confirmed
lerna info publish Publishing packages to npm...
lerna ERR! npm publish --ignore-scripts exited 1 in '#reggi/help.filter-until'
lerna ERR! npm publish --ignore-scripts stderr:
npm notice
npm notice package: #reggi/help.filter-until#0.0.23
npm notice === Tarball Contents ===
npm notice 1.5kB package.json
npm notice 609B index.build.js
npm notice === Tarball Details ===
npm notice name: #reggi/help.filter-until
npm notice version: 0.0.23
npm notice package size: 1.0 kB
npm notice unpacked size: 2.1 kB
npm notice shasum: 60ee325b219abdae06a75cfe45bc66096f715187
npm notice integrity: sha512-o4ahyOWAsUk3j[...]O/3MH2Tpv1tOQ==
npm notice total files: 2
npm notice
npm ERR! publish Failed PUT 404
npm ERR! code E404
npm ERR! 404 Not found : #reggi/help.filter-until
npm ERR! 404
npm ERR! 404 '#reggi/help.filter-until' 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.
I have the token setting using the .org domain and the registry set to the .com domain. :(
I have a problem with npm install, in that it won't install #types.
This works fine
npm install --save lodash
However asking for types does not
npm install --save #types/lodash
PS C:\Development\Temp> npm install --save #types/lodash
npm WARN `git config --get remote.origin.url` returned wrong result (git://github.com/types/lodash)
npm WARN `git config --get remote.origin.url` returned wrong result (git#github.com:types/lodash)
npm ERR! git clone git#github.com:types/lodash Cloning into bare repository 'C:\Users\myuser\AppData\Roaming\npm-cache\_git-remotes\git-github-com-types-lodash-9eb5372a'...
npm ERR! git clone git#github.com:types/lodash Host key verification failed.
npm ERR! git clone git#github.com:types/lodash fatal: Could not read from remote repository.
npm ERR! git clone git#github.com:types/lodash
npm ERR! git clone git#github.com:types/lodash Please make sure you have the correct access rights
npm ERR! git clone git#github.com:types/lodash and the repository exists.
npm ERR! addLocal Could not install types/lodash
npm ERR! Error: ENOENT: no such file or directory, stat 'C:\Development\Temp\types\lodash'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>
npm ERR! System Windows_NT 10.0.15063
npm ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\ProgramData\\chocolatey\\lib\\npm\\tools\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save" "#types/lodash"
npm ERR! cwd C:\Development\Temp
npm ERR! node -v v8.6.0
npm ERR! npm -v 1.4.9
npm ERR! path C:\Development\Temp\types\lodash
npm ERR! syscall stat
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\Development\Temp\npm-debug.log
npm ERR! not ok code 0
PS C:\Development\Temp>
This has got me scratching my head. I've updated Chocolatey, NodeJS, NPM to make sure their own the latest versions. Tried the commands on empty folders or an existing TypeScript project - thinking it might be getting confused being ran within a Git repository (error: remote.origin.url). Looking at the GitHub URL it makes no sense git://github.com/types/lodash
I took these examples from MSDN Blog - The Future of Declaration Files
Update: I've uninstalled Node.js and tried reinstalling v6.11.3 LTS or v8.6.0. However the #types command still fails.
Update 2: I've realised Chocolately was masking the npm version. I removed the Chocolately folder, and upgraded npm as per #Louis answer.
Upgrade your npm version to version 4 or 5. I'm mentioning 4 because I ran into problems with 5, and using 4 is still viable. I don't know of any good reason to run an older version.
You are using npm version 1.4.9, as shown in this line of the log:
npm ERR! npm -v 1.4.9
The problem is that npm versions prior to version 2 do not support scoped packages. Packages that begin with an # are scoped packages, so #types/lodash is a scoped package. You need npm version 2 or greater to install it. If you were to use the latest npm in the 1.x series (1.4.29), you'd get a better error message:
npm ERR! Error: This version of npm doesn't support scoped packages (caused by reference to #types/lodash). Update to npm#2+.
Version 1.4.9 did not even know that scoped packages were a thing, so it cannot give a nice error message. It looks like it took the # symbol as signifying that the package name is an address and filled in the missing information with Github as the default host.
The upgrade command I typically use to upgrade npm is:
npm install -g npm
You can specify a specific version by replacing the npm argument with one that gives specific version number. npm#4, for instance, would install the latest npm in the 4.x series. If you don't specify a version number, you get the latest released version.
I am attempting to install an npm package (markdown-pdf) as part of my Travis-CI build which I believe is not compatible with old versions of Node. On my local machine, I am running Node version 0.10.36, and it works here, so I added what I believe to be the accepted way of defining a specific version to the top of my .travis.yml file (although I'm not clear on that either). The MCVE version of the full file is below.
language: node_js
node_js:
- "0.10"
install:
- sudo apt-get install npm
- npm config set registry http://registry.npmjs.org/
- sudo npm install -g markdown-pdf
script:
- echo "stuff was installed."
At the top of the build log, I see the following, which seems to indicate that my change worked:
$ nvm install 0.10
######################################################################## 100.0%
Now using node v0.10.40
$ node --version
v0.10.40
$ npm --version
1.4.28
$ nvm --version
0.23.3
However, further down the log, when travis attempts to execute sudo npm install -g markdown-pdf, the log reports the following. Notice that it suggests that the package might not be compatible with the version of Node that is installed, and it claims that I'm using Node v0.6.12.
$ sudo npm install -g markdown-pdf
npm http GET http://registry.npmjs.org/markdown-pdf
npm http 200 http://registry.npmjs.org/markdown-pdf
npm ERR! Error: No compatible version found: markdown-pdf
npm ERR! No valid targets found.
npm ERR! Perhaps not compatible with your version of node?
npm ERR! at installTargetsError (/usr/share/npm/lib/cache.js:488:10)
npm ERR! at next_ (/usr/share/npm/lib/cache.js:438:17)
npm ERR! at next (/usr/share/npm/lib/cache.js:415:44)
npm ERR! at /usr/share/npm/lib/cache.js:408:5
npm ERR! at saved (/usr/share/npm/lib/utils/npm-registry-client/get.js:147:7)
npm ERR! at Object.oncomplete (/usr/lib/nodejs/graceful-fs.js:230:7)
npm ERR! You may report this log at:
npm ERR! <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR! reportbug --attach /home/travis/build/ahemmeter/ahemmeter.github.io/npm-debug.log npm
npm ERR!
npm ERR! System Linux 2.6.32-042stab108.3
npm ERR! command "node" "/usr/bin/npm" "install" "-g" "markdown-pdf"
npm ERR! cwd /home/travis/build/ahemmeter/ahemmeter.github.io
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! message No compatible version found: markdown-pdf
npm ERR! message No valid targets found.
npm ERR! message Perhaps not compatible with your version of node?
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/travis/build/ahemmeter/ahemmeter.github.io/npm-debug.log
npm not ok
I think I've provided enough information, but you can also look at the public build logs for the project and the github repository it's building.
Have I made a mistake in declaring which version of Node to use? Do I need to (or should I) do something similar for npm, nvm, and markdown-pdf? How can I force npm-install to use the newer version of Node rather than the old one?
Note that I set the repository to download over HTTP instead of HTTPS. When I did that, the error message changed from "failed to fetch from registry: markdown-pdf" to "No compatible version found: markdown-pdf", which seemed like a step in the right direction, so I kept it; however, I mention it here in case there is a possibility that it causes a conflict.
In order to specify dependencies when using node.js, travis seems to expect a package.json file. You can also use this to specify which version of the node package you want to download.
.travis.yml
language: node_js
node_js:
- "0.10"
script:
- echo "stuff was installed."
package.json
{
"name" : "ahemmeter.github.io",
"version" : "0.0.0",
"dependencies" : {
"markdown-pdf" : "5.3.x"
}
}
Note from OP: This is the answer I found, but If someone posts an answer that does not involve using a package.json file (this is just a test suite rather than a package and I don't want to publish it as a package), I'll mark that answer as accepted.
I have an express project that accesses some common node code that I keep in a private repository in github. I have a line like the following in my package.json file
git+ssh://git#github.com:MYGITHUBACCT/MYPROJECT.git#master
When I run npm install, everything works correctly and it pulls my common code from the private repo and places it in my node_modules directory. However, when I run npm update, it fails on my private repo and displays the following:
npm ERR! 404 'MYPROJECT' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, or http url, or git url.
npm ERR! System Darwin 12.2.0
npm ERR! command "node" "/usr/local/bin/npm" "update"
npm ERR! cwd /Users/ginnyd/dev/gg-web
npm ERR! node -v v0.8.16
npm ERR! npm -v 1.1.69
npm ERR! code E404
Is there anything special I need to do in the package.json so that I can run the update and have it pull from GitHub?
Thanks
Ginny
Apparently, this is still an open issue with npm.
Meanwhile, to update git dependencies, you have to remove them first and then doing an npm install.
rm -rf node_modules/MYPROJECT
npm install
This have fixed in npm, please upgrade to npm >= 1.3.10
Sample usage
"dependencies": {
"thing": "git://github.com/myGitHubRepo/repo.js.git#56477cb",
}
Some day later
"dependencies": {
"thing": "git://github.com/myGitHubRepo/repo.js.git#67f90b5",
}
Then npm install again and you will get new ref!
If your "myGitHubRepo/repo.js" is a private package you should set "private": true there to ensure it doesn't get accidentally published to npm registry