Azure Pipeline - npm install error 403 with Azure Feed - node.js

My NPM install step is configured to use registries in .npmrc,
My .npmrc is as follows
registry=https://pkgs.dev.azure.com/xxx/xxxx-xxxx-xxxx/_packaging/design-system/npm/registry/
always-auth=true
The Azure Artifacts feed is set-up, and a local npm install from my dev machine works completely fine.
However the pipeline's npm install job always fails with error 403.
What am I doing wrong here? I've also tried changing the npm install task to use Registry I select here, and linking it to my "design-system" feed directly, but it results in the same error. I've followed all the steps here https://learn.microsoft.com/en-us/azure/devops/artifacts/npm/npmrc?view=azure-devops&tabs=windows, but it just doesn't work. Thanks

Problem solved. What I had to do was go under into the feed -> settings -> permissions, and add the ...Build Service... as a Contributor.
Microsoft should really add this as part of their documentation. Took me several hours of random attempts before I found it..

This is a different solution for the same message, although, in this case it will fail from any location.
Trying to publish a package version previous to the last one published on the feed will return the 403 Forbidden error to, even if it's not a permissions issue.
Updating the package version to one increment after the current version will solve the problem.

Related

Fork node_module react and install not working

I tried to fork this react native module to make some corrections, because the author abandoned the project and he was the only tool I found and meets my need, so reading an article I found out about the fork, I did this procedure, then I cloned and did necessary correction, only when having to add the module to my react project with the
yarn add lucassouza16/react-native-svg-uri
I get this error:
error Couldn't find the binary git
I'm new to this forking function, is there anything else I need to do?
My bifurcated repository:
https://github.com/lucassouza16/react-native-svg-uri
Original repository:
https://github.com/vault-development/react-native-svg-uri
To add it via npm or yarn you will need to add this firstly to npm registry. Here you have more information about it https://docs.npmjs.com/packages-and-modules/contributing-packages-to-the-registry
You can also add via github doing like this:
yarn add git+https://github.com/lucassouza16/react-native-svg-uri.git
You can read more about it here:
How to install an npm package from GitHub directly?
In the end all responses resulted in the same error, yet thanks to everyone who tried to help me, but it worked when I added the release version, this is the correct format:
yarn add lucassouza16/react-native-svg-uri#1.2 .4

Getting Error 402 while publishing package using npm

I am using npm version 2.15.11 and node version 4.7.2 on ubuntu 14.04. I want to publish my packages. when i use the command:
npm publish
i am geting the error: You need a paid account to perform this action. For more info, visit: https://www.npmjs.com/private-modules
Below is the screenshot of error:
Please provide me the solution to overcome this issue. Thanks in advance.
Run
npm publish --access=public
the first time you publish a scoped package.
The default access setting is private, but for this you need a paid account. Hence the error message.
In addition to the command line option provided by bersling, you can merge the following into your package.json:
{
"publishConfig": {
"access": "public"
}
}
Reference in npm documentation. Useful when you want to template it into your package manifests and not think about it.
P.S. had one of those old OpenId accounts, forgot to update it before it was nuked, no longer have the ability to add this as a comment to bersling's reply, which is where I feel this really belongs.
In package.json, npm version 6+ you have this option:
"private": true/false,
Be sure is false, and also try to use this flag:
npm publish --access=public
you probably initialized your package with a scope so that it is private. Read
https://docs.npmjs.com/private-modules/intro
Just want to add that, if you tried all the other answers and still get this error, someone(maybe yourself) could have somehow changed the package to private previously, in which case, you need to set the package to public before you could publish again... Orz

running node.js sails app on openshift

I'm trying to deploy my node.js sails app on openshift. I followed procedure outlined in https://gist.github.com/mdunisch/4a56bdf972c2f708ccc6 but still doesn't work.
also try this: Node.js app on openshift
no matter what i'm getting "Service Temporarily Unavailable"
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later. Error.
Hopefully someone can at least point me to the right direction.
Thanks in advance.
I have also deployed my application onto openshift and here are my steps
Create a node.js Cartridges 0.10
In the repo, please mention "https://github.com/ryanj/nodejs-custom-version-openshift" since my sails need npm version 1.4.0 and the original one is 1.3.X
git clone the repo
copy your file into that repo
Follow this page https://gist.github.com/mdunisch/4a56bdf972c2f708ccc6
The first two steps should be done if you haven't changed the original stuff. The only things is to change ".openshift/action_hooks/pre_start_nodejs" and append that at the end to make it is as a production and run the grunt
git add . and git push
It will automatically build and at the end will tell you deployment completed with status: success
I am also new but hope you can try. Thanks
One more things, if missing the step 5, you won't run the sails and can't see the log in the terminal and result in 503 on browser.
But I have another question after each push on openshift, you can see my log if you want to know what is the right status
Why mongodb is reset after push to openshift
Another suggestion is to ssh and make sure the npm -v is larger than 1.4.0, try to npm install -g npm to update the version.
If still fails, i will suggest to npm install sails -g and try to commit and look for the build..

'npm install' extremely slow on Windows

For me is npm install extremely slow. I'm using Windows 8.1 with the latest npm version. My connection speed is around 100Mbit/s.
The project I'm trying to install has around 20 packages/dependencies and it takes around 30 Minutes to install all dependencies ...
Does anyone have a clue?
I ran into the same problem, using --verbose as peterh mentioned showed me the source of the problem: I am behind a proxy, which uses its own certificates for https-connections.
According to user "Mletter1" on https://github.com/npm/npm/issues/8872 the issue is quite easily solved by using http:
npm config set registry http://registry.npmjs.org/ --global
And voilà, it's fast again. Of course you should only do this, if you're ok with cleartext npm infos over the net ;-)
Warning regarding security: this is an insecure approach if you don't use any other means of antivirus protection.
From eternity → to 5 seconds builds:
search for Windows Defender settings
→ Virus & threat protection
→ Virus & threat protection Settings
→ Exclusions
here add this two paths to your list of excluded realtime protection folders:
C:\Program Files\nodejs
C:\Users\<your username>\AppData\Roaming\npm
PS: replace the <your username> with your respective User folder name; or use alias to the AppData folder like: %AppData%\npm
If you're wondering why you can't find the AppData folder in Explorer, make sure to check "View" options for "Show hidden folders".
I know its just a workaround, but try using the build-in "Windows PowerShell"
I've been facing the same issue for a while. I was trying out the following
npm i typescript live-server --save-dev
The install would get stuck at it forever. However adding the -verbose flag worked just fine.
It seems like npm do not deal well with internet connections and can sometimes end in such situation.
1) I'll advice you to check if your firewall or antivirus is not performing any scan or filtering which may slow down npm install.
2) You may also use caching from npm like below.
npm install package-name --cache "c:\path\to\use\as\dependencies\cache"
this will allow npm download and cache dependencies in the directory you specified.
3) another solution for caching npm packages dependencies is npm lazy, you may find more information about this at npm Lazy website
Note: the caching process may or may not improve the download speed but it will probably save downloads time when installing or updating your npm packages.
For me it appeared to be a problem with IPv6.
Disabling IPv6 helped immensely for me.
With IPv6 turned on "update-package newtonsoft.json" took 1:45 to time out with the error "update-package : A task was canceled."
With IPv6 disabled "update-package newtonsoft.json" completed in 10 seconds
Turning off Windows Firewall and Windows Defender Real-time protection did it for me in Windows 10.
Fully turning off virus and firewall protection isn't the safest option. While it makes things faster, it leaves you more vulnerable.
In my case, I only excluded the node.exe process in virus & threat protection.
In your start menu, type "windows security" and open the app.
Click on "Virus & threat protection"
Virus & threat protection settings => Manage settings
Exclusions => Add or remove exclusions
Add an exclusion => process => type node.exe => click Add
just a simple create-react-app went down from 2m40s to 1m10s
npm commands are also executed by node.exe, so the same improvements are noticed there.
I faced the same issue while creating project while using angular cli "ng new PROJECT_NAME" this command triggers "npm -install" after creation of project, which took too long to install, and got stuck at "Installing packages for tooling via npm" . Follow these which worked for me
1) Check your npm version "npm --version" (must be higher than 2.1.8)Update your npm package by "npm -g install --save latest-version"
2) Remove the progress bar which consumes more time "npm set progress=false"
check this issues if still doesn't fix your problem
https://github.com/nodejs/node/issues/4150
https://github.com/npm/npm/issues/11283
Hopefully this sorts the problem Cheers!
In my case it was due to over 200 vulnerabilities. When I ran
npm audit fix
that solved only just a few of them. Eventually, I had to run
npm audit fix --force
and it got way better than before.
I tried all the config's (proxy, registry, etc) nothing worked for me, so did a complete uninstall and install node & npm. Which helped to solve the issue.
Turning off the Windows Defender Firewall helped for me.
Because it just doesnt feel right I first added the WIFI to a Private Network (via WIFI settings) and only turned off the Windows Defender for a Private Network instead of all public Networks.
The next step should be: what network traffic causes this and how to add this to the Windows Defender exception rule :)
Make sure you really are using a recent version of npm. In my case C:\Program Files\nodejs\npm.cmd had been using an old npm-cli.js below the default prefix folder %appdata%\npm rather than a newer npm-cli.js below C:\Program Files\nodejs.
Setting the environment variable npm_config_prefix to C:\Program Files\nodejs solved that. (Before finding that solution, I tried using the --prefix argument and found out the hard way doing so "forces non-global commands to run in the specified folder".)
I found a huge performance increase going from 3.10.9 to 6.13.4-- enough to make npm install times acceptable despite interference from antivirus.
I just went through a rabbit hole trying to identify the issue. If npm install keeps getting bottlenecked you should heavily consider modifying the properties of your virtual ethernet and disable all of the offload items.
I had 0 proxies or caching issues with npm.
See here for the tutorial on how to get to the menu and disable your offload settings. Make sure you do this for both your your ethernet and VEthernet and you should immediately notice a difference. I went from a 10 minute hanging resolution that sometimes just stopped down to 10 seconds installs.
https://www.dincloud.com/blog/tuning-windows-get-15x-speeds-on-large-file-copies-today
in addition to all other great comments, I'd also suggest switching to yarn (https://marketplace.visualstudio.com/items?itemName=geeklearningio.gl-vsts-tasks-yarn).
using devops (selfhosted agent v.2.192.0), with node (v.14.17.6), we were able to trim total build (install + build) from ~10min to ~6-7 min.
This is highly situational but we have a local registry (npm config get registry) that was not available (VPN:d) in when I was running the npm install ... and this obviously made it very slow but it still succeeded because everything was still available through cache.

broccoli-closure-compiler install error

I am trying to test es-6 promise-polyfill, for the testing one the node packages requried is broccoli-closure-compiler, which is not getting installed, I am behind a proxy server, is that the problem, but i have proxy config for both git and npm, so they are working fine, for more info, please refer to the screenshot of the command prompt,
edit:
the text in screenshot
D:\pt>npm install broccoli-closure-compiler
npm WARN package.json jshint#0.9.1 No repository field.
\
closurecompiler#1.3.2 install D:\pt\node_modules\broccoli-closure-compiler\node_modules\closurecompiler
npm run-script configure
\
closurecompiler#1.3.2 configure D:\pt\node_modules\broccoli-closure-compiler\node_modules\closurecompiler
node scripts/configure.js
Configuring ClosureCompiler.js 1.3.2 ...
Downloading http://dl.google.com/closure-compiler/compiler-latest.tar.gz ...
? Download failed: Error: connect ETIMEDOUT
? Unfortunately, ClosureCompiler.js could not be configured.
See: https://github.com/dcodeIO/ClosureCompiler.js (create an issue maybe)
what I am suggesting is not a solution, these are mere work-around( aka really bad hacks)
if you are facing this, it is because you are behind a proxy server and one of the scripts trying to install clousurecompiler does not have the proxy settings set.
work around one : well, find a way to connect without proxy server, or install in a machine outside proxy server, copy the node_module files to your system,
work around 2 (the one I used) :
when you look at the screenshot, you would notice that at one point "node scripts/configure.js" is run, this is the crucial point, find a way to pause the processing just before this point,
open the 'configure.js' file, it would be at '.\node_modules\broccoli-closure-compiler\node_modules\closurecompiler\scripts' in node project directory,
comment line 65 in that i.e fail(); to //fail();
continue the installation process,
manually download http://dl.google.com/closure-compiler/compiler-latest.tar.gz , put the extracted file at '.\node_modules\broccoli-closure-compiler\node_modules\closurecompiler\compiler' in your project directory
(... told you this is a bad solution )

Resources