I Cant install puppeteer - javascript

I ran this script -> npm i --save-dev puppeteer to install puppeteer for e2e testing purposes.
But there is an error while installing:
C:\Users\Mora\Desktop\JS\Testing>npm i --save-dev puppeteer
> puppeteer#13.1.3 install C:\Users\Mora\Desktop\JS\Testing\node_modules\puppete
er
> node install.js
ERROR: Failed to set up Chromium r950341! Set "PUPPETEER_SKIP_DOWNLOAD" env vari
able to skip download.
Error: Download failed: server returned code 403. URL: https://storage.googleapi
s.com/chromium-browser-snapshots/Win/950341/chrome-win.zip
at C:\Users\Mora\Desktop\JS\Testing\node_modules\puppeteer\lib\cjs\puppeteer
\node\BrowserFetcher.js:367:27
at ClientRequest.requestCallback (C:\Users\Mora\Desktop\JS\Testing\node_modu
les\puppeteer\lib\cjs\puppeteer\node\BrowserFetcher.js:493:13)
at Object.onceWrapper (events.js:483:26)
at ClientRequest.emit (events.js:376:20)
at HTTPParser.parserOnIncomingClient (_http_client.js:647:27)
at HTTPParser.parserOnHeadersComplete (_http_common.js:126:17)
at TLSSocket.socketOnData (_http_client.js:515:22)
at TLSSocket.emit (events.js:376:20)
at addChunk (internal/streams/readable.js:309:12)
at readableAddChunk (internal/streams/readable.js:284:9)
npm WARN js-testing-introduction#1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.3.2 (node_modules\fse
vents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#
2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"ia32"
})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules\wa
tchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#
1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"ia32
"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! puppeteer#13.1.3 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the puppeteer#13.1.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Mora\AppData\Roaming\npm-cache\_logs\2022-02-06T10_19_25_3
69Z-debug.log
How can i fix this?

It looks like it is not able to download chromium from https://storage.googleapis.com/chromium-browser-snapshots/Win/950341/chrome-win.zip.
Check whether your network is e.g behind a proxy or storage.googleapis.com was blocked by the firewall.

// do not install a puppeteer
ran this script -> npm install --ignore-scripts puppeteer

Related

gatsby-cli installation is not recognising current Node version

I'm trying to install gatsby-cli in Ubuntu 18.04 using the command sudo npm install -g gatsby-cli.
My Node version is 16.14.2 and npm 8.5.0.
But gatsby installation does not recognise these versions. It keeps saying that my current versions are Node 8.5.0 and npm 3.5.2, causing installation errors as you can see in the terminal output below.
What can I do to fix this?
WARN engine gatsby-cli#4.13.0: wanted: {"node":">=14.15.0"} (current: {"node":"8.10.0","npm":"3.5.2"})
loadDep:yurnalist → addNa
WARN engine execa#5.1.1: wanted: {"node":">=10"} (current: {"node":"8.10.0","npm":"3.5.2"})
loadDep:yurnalist → addNa
loadDep:yurnalist → resol
WARN engine gatsby-telemetry#3.13.0: wanted: {"node":">=14.15.0"} (current: {"node":"8.10.0","npm":"3.5.2"})
WARN engine boxen#5.1.2: wanted: {"node":">=10"} (current: {"node":"8.10.0","npm":"3.5.2"})
WARN engine gatsby-core-utils#3.13.0: wanted: {"node":">=14.15.0"} (current: {"node":"8.10.0","npm":"3.5.2"})
WARN engine semver#7.3.7: wanted: {"node":">=10"} (current: {"node":"8.10.0","npm":"3.5.2"})
WARN engine hosted-git-info#3.0.8: wanted: {"node":">=10"} (current: {"node":"8.10.0","npm":"3.5.2"})
npm WARN deprecated uuid#3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
loadDep:is-wsl → 304
loadDep:wrap-ansi → resol
WARN engine type-fest#0.20.2: wanted: {"node":">=10"} (current: {"node":"8.10.0","npm":"3.5.2"})
loadDep:typedarray-to-buf
loadDep:strip-final-newli
loadDep:mimic-fn → addNam
loadDep:tmp → request
npm ERR! Linux 4.15.0-176-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "gatsby-cli"
npm ERR! node v8.10.0
npm ERR! npm v3.5.2
npm ERR! code EMISSINGARG
npm ERR! typeerror Error: Missing required argument #1
npm ERR! typeerror at andLogAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:31:3)
npm ERR! typeerror at fetchPackageMetadata (/usr/share/npm/lib/fetch-package-metadata.js:51:22)
npm ERR! typeerror at resolveWithNewModule (/usr/share/npm/lib/install/deps.js:456:12)
npm ERR! typeerror at /usr/share/npm/lib/install/deps.js:457:7
npm ERR! typeerror at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror at /usr/share/npm/lib/fetch-package-metadata.js:37:12
npm ERR! typeerror at addRequestedAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:82:5)
npm ERR! typeerror at returnAndAddMetadata (/usr/share/npm/lib/fetch-package-metadata.js:117:7)
npm ERR! typeerror at pickVersionFromRegistryDocument (/usr/share/npm/lib/fetch-package-metadata.js:134:20)
npm ERR! typeerror at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror This is an error with npm itself. Please report this error at:
npm ERR! typeerror <http://github.com/npm/npm/issues>
WARN engine tmp#0.2.1: wanted: {"node":">=8.17.0"} (current: {"node":"8.10.0","npm":"3.5.2"})
WARN engine import-from#4.0.0: wanted: {"node":">=12.2"} (current: {"node":"8.10.0","npm":"3.5.2"})
WARN engine got#11.8.3: wanted: {"node":">=10.19.0"} (current: {"node":"8.10.0","npm":"3.5.2"})
npm ERR! Please include the following file with any support request:
npm ERR! /home/development/blog-gatsby/npm-debug.log
I managed to fix the error above. The problem was that, even using yarn or npm without sudo, the installation process happened with the Node version installed for the root user, which was 8.10.0.
To fix that, I logged as a root user and did:
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs
After that, the command gatsby was installed with no issues with the command sudo npm install -g gatsby-cli.
Hope this could be helpful for someone.

I can't install puppeteer

I have a problem with install puppeteer.
I set Visual Code in firewall
When I write npm install puppeteer terminal show me this ERROR :
ERROR: Failed to set up Chromium r869685! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.
Error: Download failed: server returned code 403. URL: https://storage.googleapis.com/chromium-browser-snapshots/Win/869685/chrome-win.zip
at D:\webs\scraper\node_modules\puppeteer\lib\cjs\puppeteer\node\BrowserFetcher.js:366:27
at ClientRequest.requestCallback (D:\webs\scraper\node_modules\puppeteer\lib\cjs\puppeteer\node\BrowserFetcher.js:492:13)
at Object.onceWrapper (events.js:483:26)
at ClientRequest.emit (events.js:376:20)
at HTTPParser.parserOnIncomingClient (_http_client.js:647:27)
at HTTPParser.parserOnHeadersComplete (_http_common.js:126:17)
at TLSSocket.socketOnData (_http_client.js:515:22)
at TLSSocket.emit (events.js:376:20)
at addChunk (internal/streams/readable.js:309:12)
at readableAddChunk (internal/streams/readable.js:284:9)
npm WARN enoent ENOENT: no such file or directory, open 'D:\webs\scraper\package.json'
npm WARN scraper No description
npm WARN scraper No repository field.
npm WARN scraper No README data
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! puppeteer#9.1.1 install: node install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the puppeteer#9.1.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\AA\AppData\Roaming\npm-cache\_logs\2021-05-28T13_57_47_494Z-debug.log
Thanks for help.
Google is blocking you to download.
Try this :-
set environment variable PUPPETEER_DOWNLOAD_HOST to http://storage.googleapis.com

sh: node: command not found - when npm install command on AWS Instance

I want to run a node app on AWS EC2 instance. I installed node through this official method by AWS Doc https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-up-node-on-ec2-instance.html.
Then, I can view the version of node and npm but when I give the command npm install on the node app folder , it starts to install a few dependencies and then it fails. with the error as
> core-js#2.6.11 postinstall /var/apps/backend-master/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
sh: node: command not found
npm WARN mysql_db#1.0.0 No description
npm WARN mysql_db#1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.1.3 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! core-js#2.6.11 postinstall: `node -e "try{require('./postinstall')}catch(e){}"`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the core-js#2.6.11 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-06-16T19_28_07_911Z-debug.log
Do let me know if there is an additional step to do or if I am wrong somewhere

Installing phantomjs using npm error

I'm doing a unit testing for my javascript codes. I prefer to use a headless browser for easier running. It goes well when I installed some dependencies but when I install phantomjs, it has an error.
C:\Phantomjs>npm install -g phantomjs npm WARN deprecated
phantomjs#2.1.7: Package renamed to phantomjs-prebuilt. Plea se update
'phantomjs' package references to 'phantomjs-prebuilt' npm WARN
deprecated node-uuid#1.4.8: Use uuid module instead npm WARN
deprecated tough-cookie#2.2.2: ReDoS vulnerability parsing Set-Cookie
h ttps://nodesecurity.io/advisories/130
C:\Users.ra\AppData\Roaming\npm\phantomjs ->
C:\Users.ra\AppDa
ta\Roaming\npm\node_modules\phantomjs\bin\phantomjs
phantomjs#2.1.7 install C:\Users.ra\AppData\Roaming\npm\node_modules\ phantomjs
node install.js
Considering PhantomJS found at
C:\Users.ra\AppData\Roaming\npm\phantomj s.CMD Looks like an
npm install -g on windows; skipping installed version. Downloading
https://github.com/Medium/phantomjs/releases/download/v2.1.1//phanto
mjs-2.1.1-windows.zip Saving to
C:\Users.ra\AppData\Local\Temp\phantomjs\phantomjs-2.1.1-wind
ows.zip Using proxy http://.ra:******#proxy:3128/ Receiving...
Error making request. Error: tunneling socket could not be
established, statusCode=502
at ClientRequest.onConnect (C:\Users.ra\AppData\Roaming\npm\node_mo
dules\phantomjs\node_modules\tunnel-agent\index.js:165:19)
at Object.onceWrapper (events.js:320:30)
at emitThree (events.js:135:13)
at ClientRequest.emit (events.js:216:7)
at Socket.socketOnData (_http_client.js:470:11)
at emitOne (events.js:115:13)
at Socket.emit (events.js:210:7)
at addChunk (_stream_readable.js:264:12)
at readableAddChunk (_stream_readable.js:251:11)
at Socket.Readable.push (_stream_readable.js:209:10)
Please report this full log at https://github.com/Medium/phantomjs npm
WARN Error: EPERM: operation not permitted, scandir
'C:\Users.ra\Ap
pData\Roaming\npm\node_modules\phantomjs\node_modules\dashdash\node_modules'
npm WARN { Error: EPERM: operation not permitted, scandir
'C:\Users.ra
\AppData\Roaming\npm\node_modules\phantomjs\node_modules\dashdash\node_modules'
npm WARN stack: 'Error: EPERM: operation not permitted, scandir
\'C:\Users\p
ardillo.ra\AppData\Roaming\npm\node_modules\phantomjs\node_modules\dashda
sh\node_modules\'', npm WARN errno: -4048, npm WARN code:
'EPERM', npm WARN syscall: 'scandir', npm WARN path:
'C:\Users\.ra\AppData\Roaming\npm\node_modules\p
hantomjs\node_modules\dashdash\node_modules' } npm ERR! code
ELIFECYCLE npm ERR! errno 1 npm ERR! phantomjs#2.1.7 install: node
install.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the
phantomjs#2.1.7 install script. npm ERR! This is probably not a
problem with npm. There is likely additional log ging output above.`
What should I do?
The simplest installation method is
Install NodeJS
Using Node's package manager install phantomjs: npm -g install phantomjs-prebuilt
After installation, you may use phantom as simple as:
driver = webdriver.PhantomJS() # or add to your PATH
driver.set_window_size(1024, 768) # optional
driver.get('https://google.com/')
driver.save_screenshot('screen.png') # save a screenshot to disk
sbtn = driver.find_element_by_css_selector('button.gbqfba')
sbtn.click()
If your system path environment variable isn't set correctly, you'll need to specify the exact path as an argument to webdriver.PhantomJS(). Replace this:
driver = webdriver.PhantomJS() # or add to your PATH
... with the following:
driver = webdriver.PhantomJS(executable_path='/usr/local/lib/node_modules/phantomjs/lib/phantom/bin/phantomjs')
References:
How do I set a proxy for phantomjs/ghostdriver in python webdriver?
https://dzone.com/articles/python-testing-phantomjs
Try run npm install phantomjs-prebuilt
phantomjs name changed to phantomjs-prebuilt on Pre-2.0 version release.
Source: view this link for detailed description of the name change.

npm start error angularjs(frontend)

$ npm start
angular-seed#0.0.0 prestart C:\wamp64\www\myapplication
npm install
npm WARN invalid config loglevel="notice"
angular-seed#0.0.0 postinstall C:\wamp64\www\myapplication
bower install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.1.3
(node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY:
Unsupported platform for fsevents#1.1.3: wanted
{"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
up to date in 78.888s
angular-seed#0.0.0 start C:\wamp64\www\myapplication
http-server -a localhost -p 8001 -c-1 ./app
events.js:160
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE 127.0.0.1:8001
at Object.exports._errnoException (util.js:1020:11)
at exports._exceptionWithHostPort (util.js:1043:20)
at Server._listen2 (net.js:1262:14)
at listen (net.js:1298:10)
at net.js:1408:9
at GetAddrInfoReqWrap.asyncCallback [as callback] (dns.js:62:16)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:81:10) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! angular-seed#0.0.0
start: http-server -a localhost -p 8001 -c-1 ./app npm ERR! Exit
status 1 npm ERR! npm ERR! Failed at the angular-seed#0.0.0 start
script. npm ERR! This is probably not a problem with npm. There is
likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\AppData\Roaming\npm-cache_logs\2018-01-07T16_08_23_941Z-debug.log
i had this error when i run npm start frontend(angularjs)and in the symfony is run correctly can someone have a idea how can i solve.
Another process is already listening on port 8001. You are either trying to start your server twice, or there is another server/application which uses that port. The solution is to change the port or kill the process which listens on the same port.

Categories

Resources