- 
				            Node.js, npm i gulp w CentOS 7Potrzeby programistów są co raz większe. Kiedyś wystarczyły zainstalował PHP i jakiś silnik bazodanowym, a teraz …. Coraz częściej stajemy przed sytuacją, że musimy zaimplementować obsługę node.js oraz takie narzędzia jak npm, czy gulp. Skupię się na aktualnej- 8 wersji LTS Node.js. https://www.davidvandertuijn.nl/centos-7-install-nodejs-npm-and-gulp curl --silent --location https://rpm.nodesource.com/setup_8.x | bash - 
 ## Installing the NodeSource Node.js 8.x LTS Carbon repo...## Inspecting system... + rpm -q --whatprovides redhat-release || rpm -q --whatprovides centos-release || rpm -q --whatprovides cloudlinux-release || rpm -q --whatprovides sl-release 
 + uname -m## Confirming "el7-x86_64" is supported... + curl -sLf -o /dev/null 'https://rpm.nodesource.com/pub_8.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm' ## Downloading release setup RPM... + mktemp 
 + curl -sL -o '/tmp/tmp.dImzcAoghY' 'https://rpm.nodesource.com/pub_8.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'## Installing release setup RPM... + rpm -i --nosignature --force '/tmp/tmp.dImzcAoghY' ## Cleaning up... + rm -f '/tmp/tmp.dImzcAoghY' ## Checking for existing installations... + rpm -qa 'node|npm' | grep -v nodesource 
 
 Instalujemy node.js oraz npm poniższym poleceniemyum install nodejs 
 Rozwiązywanie zależności
 --> Wykonywanie sprawdzania transakcji
 ---> Pakiet nodejs.x86_64 2:8.11.4-1nodesource zostanie zainstalowany
 --> Ukończono rozwiązywanie zależnościRozwiązano zależności ================================================================================================================================================================================================================================ 
 Package Architektura Wersja Repozytorium Rozmiar
 ================================================================================================================================================================================================================================
 Instalowanie:
 nodejs x86_64 2:8.11.4-1nodesource nodesource 17 MPodsumowanie transakcji 
 ================================================================================================================================================================================================================================
 Instalacja 1 PakietCałkowity rozmiar pobierania: 17 M 
 Rozmiar po zainstalowaniu: 51 M
 Is this ok [y/d/N]: y
 Downloading packages:
 ostrzeżenie: /var/cache/yum/x86_64/7/nodesource/packages/nodejs-8.11.4-1nodesource.x86_64.rpm: Nagłówek V4 RSA/SHA256 Signature, identyfikator klucza 34fa74dd: NOKEY===================== ] 12 MB/s | 16 MB 00:00:00 ETA
 Klucz publiczny dla nodejs-8.11.4-1nodesource.x86_64.rpm nie jest zainstalowany
 nodejs-8.11.4-1nodesource.x86_64.rpm | 17 MB 00:00:03
 Pobieranie klucza z file:///etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL
 Importowanie GPG klucza 0x34FA74DD:
 Identyfikator użytkownika: "NodeSource" 
 Odcisk palca : 2e55 207a 95d9 944b 0cc9 3261 5ddb e8d4 34fa 74dd
 Pakiet : nodesource-release-el7-1.noarch (installed)
 Z : /etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL
 W porządku? [t/N]: t
 Running transaction check
 Running transaction test
 Transaction test succeeded
 Running transaction
 Instalowanie : 2:nodejs-8.11.4-1nodesource.x86_64 1/1
 Sprawdzanie : 2:nodejs-8.11.4-1nodesource.x86_64 1/1Zainstalowano: 
 nodejs.x86_64 2:8.11.4-1nodesourceUkończono. 
 Następnie już przy użyciu „npm” instalujemy gulp-a. npm install gulp 
 npm WARN deprecated [email protected]: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
 npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
 npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
 npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
 npm WARN notice [SECURITY] lodash has the following vulnerability: 1 low. Go here for more details: https://nodesecurity.io/advisories?search=lodash&version=1.0.2 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
 npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
 npm WARN notice [SECURITY] minimatch has the following vulnerability: 1 high. Go here for more details: https://nodesecurity.io/advisories?search=minimatch&version=0.2.14 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
 npm WARN notice [SECURITY] minimatch has the following vulnerability: 1 high. Go here for more details: https://nodesecurity.io/advisories?search=minimatch&version=2.0.10 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
 npm WARN saveError ENOENT: no such file or directory, open '/root/package.json'
 npm notice created a lockfile as package-lock.json. You should commit this file.
 npm WARN enoent ENOENT: no such file or directory, open '/root/package.json'
 npm WARN root No description
 npm WARN root No repository field.
 npm WARN root No README data
 npm WARN root No license field.+ [email protected] 
 added 253 packages in 12.981s
 Niestety wydając komendę „gulp -v” dostaniemy poniższy komunikat 
 
 -bash: gulp: nie znaleziono polecenia
 
 Szukamy więc binarkifind / -name gulp Przykładowy efekt powyższego polecenia: 
 
 /root/node_modules/.bin/gulp
 /root/node_modules/gulp
 
 Gulp i inne moduły node.js zainstalowały się w katalogu roota, co nie jest do końca pożądane, bo inni użytkownicy nie będę mieli do niego dostępu. Dlatego możemy/powinniśmy przenieść katalog „node_modules” np. do /opt i wtedy wydać polecenie:ln -s /opt/node_modules/.bin/gulp /usr/bin/ Następnie po wykonaniu komendy „gulp -v”, dostaniemy: 
 
 [14:47:23] CLI version 3.9.1
 [14:47:23] Local version 3.9.1
 
 Powodzenia 🙂
