Je ne peux pas réinstaller phantomjs 1.9.8 à 2.1.1 version sur mon ubuntu 16.04 S'il vous plaît aider. 1.9.8 donnez-moi des erreurs lorsque j'écris des fonctions de spin, dans la documentation voir que ce problème je peux résoudre avec réinstallation.Comment mettre à jour phantomjs 1.9.8 vers phantomjs 2.1.1 sur ubuntu?
Répondre
Je viens d'installer PhantomJS 2.1.1 dans ubuntu 16.04 les étapes suivantes, que je trouve après un peu de googler:
sudo apt-get install nodejs
sudo apt-get install nodejs-legacy
sudo apt-get install npm
sudo npm -g install phantomjs-prebuilt
Voici comment je le ferais si je développe. Les paquets sont versionnés à nodejs et non ubuntu:
Utilisation nvm
: https://github.com/creationix/nvm
touch ~/.profile
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.7/install.sh | bash
source ~/.profile
# node 6x
nvm install 6.5.0
npm install [email protected]
# node 4x
nvm install 4.5.0
nvm use 4.5.0
npm install [email protected]
# node 0.12x
nvm install 0.12
npm show [email protected]* version
npm install [email protected]
Peut-être que nous développons sur 0.10, 0.12, 4.X, iojs4.x, 6.X, etc
bien maintenant nous avons accès à choisir selon la version de PhantomJS:
[email protected]:~$ npm show [email protected]* version
[email protected] '0.0.1'
[email protected] '0.0.2'
[email protected] '0.0.3'
[email protected] '0.0.4'
[email protected] '0.0.5'
[email protected] '0.0.6'
[email protected] '0.0.7'
[email protected] '0.0.8'
[email protected] '0.0.9'
[email protected] '0.1.0'
[email protected] '0.1.1'
[email protected] '0.2.0'
[email protected] '0.2.1'
[email protected] '0.2.2'
[email protected] '0.2.3'
[email protected] '0.2.4'
[email protected] '0.2.5'
[email protected] '0.2.6'
[email protected] '1.9.8'
[email protected] '1.9.9'
[email protected] '1.9.10'
[email protected] '1.9.11'
[email protected] '1.9.12'
[email protected] '1.9.13'
[email protected] '1.9.15'
[email protected] '1.9.16'
[email protected] '1.9.17'
[email protected] '1.9.18'
[email protected] '1.9.19'
[email protected] '2.1.1'
[email protected] '2.1.2'
[email protected] '2.1.3'
[email protected] '1.9.20'
[email protected] '2.1.7'
à l'échelle du système pour les scénarios de déploiement, etc.
Voici comment utiliser l'archive tar
export PHANTOM_JS_VERSION=2.1.1
wget "https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-$PHANTOM_JS_VERSION-linux-x86_64.tar.bz2"
tar xvfj "./phantomjs-$PHANTOM_JS_VERSION-linux-x86_64.tar.bz2"
ln -sf "./phantomjs-$PHANTOM_JS_VERSION-linux-x86_64/bin/phantomjs" "/usr/bin"
testé sur ubuntu 14.04, le déplacement peut-être le dossier à un autre endroit autre que ./
mise à jour pour 16,04:
wget peut ou peut ne pas voir: https://github.com/Medium/phantomjs/issues/161
# install dependencies
sudo apt-get install libfontconfig
# extract the tar file
tar xvfj "./phantomjs-$PHANTOM_JS_VERSION-linux-x86_64.tar.bz2"
# use full path
ln -sf "$(pwd)/phantomjs-$PHANTOM_JS_VERSION-linux-x86_64/bin/phantomjs" "/usr/bin"
Erreur
PhantomJS: Erreur lors du chargement des bibliothèques partagées: libfontconfig.so.1: ne peut pas ouvrir le fichier objet partagé: Aucun fichier ou répertoire
Essayez:
sudo apt-get install libfontconfig
Ne fonctionne pas sur Ubuntu 16.04 – 3zzy
@ 3zzy vous avez raison, mis à jour ressemblait à un problème de dépendance, et un lien vers un chemin relatif pourrait avoir été un problème. De plus, pour une raison quelconque, 'wget' ne fonctionnait pas alors je' scp' la balle de tar à la machine. Problème de github ajouté avec la même erreur d'accès refusé. – jmunsch
Pour ceux qui ont des problèmes à installer comme moi
c'est plus facile que vous ne le pensez ...
- désinstaller PhantomJS: Retirer PhantomJS de ubuntu
sudo apt-get remove phantomjs
ou de supprimer le dossier de NPM de/node_modules/phantomjs
il sera/
, vous peut-être besoin d'enleverln
le lien de PhantomJS dans/usr/bin
ou/usr/local/bin/
le nom de celui-ci estphantomjs
Exemple
//use this if you installed with apt-get
sudo apt-get remove phantomjs *remove the phantomjs
rm /usr/bin/phantomjs *use this if the link didn't remove.
//use this if you installed from npm: like this: npm install phantomjs
rm -R /node_modules/phantomjs *note: it will be in other folder, search it.
- installer PhantomJS de NPM:
npm install phantomjs
à partir/
répertoire, installez NPM dans le dossier/node_module/phantomjs
Exemple
cd /;
npm install phantomjs
- fichier bin Test
Exemple
//check version of phantomjs
/node_modules/phantomjs/bin/phantomjs -v
/node_modules/phantomjs/bin/phantomjs test.js
- bin fichier lien vers
/usr/bin
:
Exemple
ln -sf /node_modules/phantomjs/bin/phantomjs /usr/bin/phantomjs
- version contrôle de celui-ci pour voir si elle est ok
phantomjs -v
dans mon cas2.1.1
Donc, la réponse de jmunsch fonctionne pour moi, mais juste pour fournir une recette claire et minimale:
export PHANTOM_JS_VERSION=2.1.1
sudo apt-get install libfontconfig
wget "https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-$PHANTOM_JS_VERSION-linux-x86_64.tar.bz2"
tar xvfj "./phantomjs-$PHANTOM_JS_VERSION-linux-x86_64.tar.bz2"
ln -sf "$(pwd)/phantomjs-$PHANTOM_JS_VERSION-linux-x86_64/bin/phantomjs" "/usr/bin"
La dernière ligne nécessite sudo en raison de/usr/bin, mais vous pouvez mettre le symlink partout ...
Actuellement, phantomjs 2.1.1 est livré avec 16.04 (https://launchpad.net/ubuntu/xenial/+source/phantomjs), vous devriez donc pouvoir l'installer/le mettre à niveau en tant que paquet système.
Mise à jour: Cette réponse existe à des fins d'information, mais il est pas recommandé d'utiliser la version du package du système maintenant en raison de problèmes tels que: https://bugs.launchpad.net/ubuntu/+source/phantomjs/+bug/1605628 Ceci est lié à un problème avec le téléchargement de fichier qui a été fixé en amont, mais le La nature du correctif l'a empêché de fonctionner en tant que package système.
La meilleure option actuelle est d'utiliser le binaire de préconstruit: https://bitbucket.org/ariya/phantomjs/download
Depuis PhantomJS n'a rien à voir avec Node.js ou NPM (installé uniquement pour des raisons pratiques), Installe un écosystème entier pour un seul binaire qui n'a rien à faire avec l'écosystème. –
Assez vrai. Les nœudsjs (et nodejs-legacy) sont requis par npm pour installer avec succès phantomjs. Les étapes que j'ai suivies étaient pour une utilisation avec du sélénium en python. Le npm peut toujours être désinstallé une fois terminé.C'était juste un moyen très rapide de faire fonctionner le pilote PhantomJS avec du sélénium. – dmdip