Non riesco a reinstallare phantomjs dalla versione 1.9.8 alla 2.1.1 su Ubuntu 16.04 Per favore aiuto. 1.9.8 dammi un errore quando scrivo una funzione di rotazione, nella documentazione vedi che questo ploblem posso risolvere con il reinstalation.Come aggiornare phantomjs 1.9.8 a phantomjs 2.1.1 su ubuntu?
risposta
Ho appena installato phantomjs 2.1.1 in Ubuntu 16.04 con le seguenti fasi, che ho trovato dopo un po 'di googling:
sudo apt-get install nodejs
sudo apt-get install nodejs-legacy
sudo apt-get install npm
sudo npm -g install phantomjs-prebuilt
Ecco come lo farei se fossi in via di sviluppo. I pacchetti sono di versione per nodejs e non ubuntu:
Uso 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]
Forse stiamo sviluppando su 0.10, 0.12, 4.X, iojs4.x, 6.X, etc
bene ora abbiamo accesso a scegliere quale versione di 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'
sistema per scenari di implementazione, ecc.
Ecco come utilizzare il tarball
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"
testato su Ubuntu 14.04, forse spostare la cartella in un'altra posizione diversa da ./
aggiornamento per 16.04:
wget può o non può lavorare vedi: 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"
Errore
phantomjs: errore durante il caricamento librerie condivise: libfontconfig.so.1: non può aprire il file oggetto condiviso: Nessun file o directory
Prova:
sudo apt-get install libfontconfig
Non funziona su Ubuntu 16.04 – 3zzy
@ 3zzy hai ragione, aggiornato sembrava un problema di dipendenza, e il collegamento a un percorso relativo potrebbe essere stato un problema. Anche per qualsiasi ragione 'wget' non funzionava quindi ho' scp' la pallina di catrame sulla macchina. Aggiunto problema github con lo stesso errore negato 403 acess. – jmunsch
Per coloro che hanno problemi di installare come me
è più facile di quanto si pensi ...
- I disinstallare phantomjs: Rimuovere phantomjs da Ubuntu
sudo apt-get remove phantomjs
o rimuovere la cartella NPM di/node_modules/phantomjs
sarà in/
, forse sarà necessario rimuovereln
il link del phantomjs in/usr/bin
o/usr/local/bin/
il nome di esso èphantomjs
Esempio
//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.
- installare phantomjs da NPM:
npm install phantomjs
da/
directory, NPM installarlo nella cartella/node_module/phantomjs
Esempio
cd /;
npm install phantomjs
- file bin test
Esempio
//check version of phantomjs
/node_modules/phantomjs/bin/phantomjs -v
/node_modules/phantomjs/bin/phantomjs test.js
- link file bin a
/usr/bin
:
Esempio
ln -sf /node_modules/phantomjs/bin/phantomjs /usr/bin/phantomjs
- versione controllo di esso per vedere se è ok
phantomjs -v
nel mio caso2.1.1
Quindi, la risposta di jmunsch funziona per me, ma solo per fornire una chiara e minimale ricetta:
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"
L'ultima riga richiede sudo a causa di/usr/bin, ma si può mettere il link simbolico da nessuna parte ...
phantomjs 2.1.1 è attualmente fornito in bundle con 16.04 (https://launchpad.net/ubuntu/xenial/+source/phantomjs), quindi è possibile installarlo/aggiornarlo come pacchetto di sistema.
Update: esiste questa risposta per scopi informativi, ma è sconsigliato di utilizzare la versione del pacchetto di sistema ora a causa di problemi quali: https://bugs.launchpad.net/ubuntu/+source/phantomjs/+bug/1605628 Questo è legato a un problema con il caricamento di file che è stato fissato a monte, ma la la natura della correzione gli impediva di funzionare come un pacchetto di sistema.
L'opzione migliore corrente è utilizzare il binario precompilato da: https://bitbucket.org/ariya/phantomjs/download
- 1. Flex su PhantomJS
- 2. javascriptEnabled problema su Phantomjs
- 3. phantomjs pdf a stdout
- 4. Impossibile trovare phantomjs
- 5. Come usare phantomjs?
- 6. Installazione di PhantomJS su Mac
- 7. Impossibile installare phantomjs sul server
- 8. Phantomjs Function.prototype.bind
- 9. phantomjs: come utilizzare i moduli npm in phantomjs?
- 10. come raschiare legami con phantomjs
- 11. phantomjs compilare con webGL
- 12. proxy cntlm con phantomjs
- 13. Come utilizzare ES6 con PhantomJS
- 14. PhantomJS Render Page Fonts
- 15. Come testare String.prototype.includes in PhantomJS
- 16. phantomjs e requirejs
- 17. Nodejs + phantomjs vs pure phantomjs - tempo di caricamento della pagina
- 18. PhantomJS non riesce a caricare Google Maps
- 19. PhantomJS 2.0 appeso su un test ambra
- 20. PhantomJS teamcity config
- 21. Genera PDF a pagina singola con PhantomJS
- 22. Corridore spec. Jasmine/PhantomJs
- 23. PhantomJS supporta geolocalizzazioni?
- 24. Selenio/PhantomJS genera l'errore
- 25. Come aggiornare Django su ubuntu?
- 26. Come risolvere PhantomJS non trovato su PATH su OS X?
- 27. Passare una variabile a PhantomJS tramite exec
- 28. Imposta altezza elemento in PhantomJS
- 29. Phantomjs tramite selenio in python
- 30. PhantomJS la gestione degli errori
Dal PhantomJS non ha nulla a che fare con node.js o NPM (installato solo per comodità), questo installa un intero ecosistema per un singolo binario che non ha nulla fare con l'ecosistema. –
Abbastanza vero. Il nodejs (e nodejs-legacy) sono richiesti da npm per installare correttamente phantomjs. I passi che ho seguito sono stati utilizzati con il selenio in python. Il npm potrebbe sempre essere disinstallato una volta fatto.Questo era solo un modo molto veloce per far funzionare il driver PhantomJS con il selenio. – dmdip