Changes

Jump to navigation Jump to search
1,609 bytes added ,  11:42, 24 May 2022
m
Line 1: Line 1: −
== npm Behind Proxy ==
+
===Install Kali===
 +
<syntaxhighlight lang="bash">
 +
sudo apt-key adv --keyserver hkp://keys.gnupg.net --recv-keys 1655A0AB68576280
 +
sudo nano /etc/apt/sources.list.d/nodesource.list
 +
</syntaxhighlight><syntaxhighlight lang="text">
 +
deb https://deb.nodesource.com/node_12.x stretch main
 +
deb-src https://deb.nodesource.com/node_12.x stretch main
 +
</syntaxhighlight><syntaxhighlight lang="bash">
 +
sudo apt update
 +
sudo apt install nodejs npm
 +
</syntaxhighlight><br />
 +
==NPM (Node package manager)==
 +
===Create new project===
 +
<syntaxhighlight lang="bash">
 +
npm init
 +
</syntaxhighlight>
 +
===Install package in project===
 +
<syntaxhighlight lang="bash">
 +
npm install jquery
 +
</syntaxhighlight>packages will be downloaded to node_modules folder
 +
===Install modules from existing project===
 +
<syntaxhighlight lang="bash">
 +
npm install
 +
</syntaxhighlight>
 +
 
 +
===Fix broken===
 +
<syntaxhighlight lang="bash">
 +
npm cache clean --force
 +
rm -rf node_modules
 +
# rm package-lock.json  # If not updating packages
 +
# npm install
 +
</syntaxhighlight>
 +
 
 +
==package.json==
 +
~ only allows patch updates
 +
 
 +
^ only allows minor version update
 +
 
 +
<nowiki>*</nowiki> allows mayor version upgrades<syntaxhighlight lang="json">
 +
"dependencies": {
 +
    "@angular/animations": "^12.2.9",
 +
    "@angular/cdk": "~12.2.9",
 +
    "@angular/common": "*"
 +
}
 +
</syntaxhighlight>
 +
 
 +
==npm Behind Proxy==
 +
<syntaxhighlight lang="bash">
 +
npm config set http-proxy http://user:pass@proxy.example.com:3128
 +
npm config set https-proxy http://user:pass@proxy.example.com:3128
 +
</syntaxhighlight>
 +
 
 +
== npm cli ==
 +
<syntaxhighlight lang="bash">
 +
npm view <packagename> versions --json
 +
npm install jquery@"^1.9.0"
 +
</syntaxhighlight>

Navigation menu