Puppeteer installation has error - google-chrome-headless

I have problem with puppeteer. I cannot install it on my debian 8.7.1.
These are the steps:
1.install chrome:
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
sudo apt-get -f install
sudo dpkg -i google-chrome-stable_current_amd64.deb
2.install nodejs & puppeteer:
apt-get install curl
curl -sL https://deb.nodesource.com/setup_8.x | bash -
sudo apt-get install -y nodejs
npm i puppeteer
When I run npm i puppeteer, the errors are:
> puppeteer#0.11.0 install /root/node_modules/puppeteer
> node install.js
ERROR: Failed to download Chromium r499413! Set "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" env variable to skip download.
Error: Download failed: server returned code 403. URL: https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/499413 /chrome-linux.zip
at ClientRequest.https.get.response (/root/node_modules/puppeteer/utils/ChromiumDownloader.js:195:21)
at Object.onceWrapper (events.js:316:30)
at emitOne (events.js:115:13)
at ClientRequest.emit (events.js:210:7)
at HTTPParser.parserOnIncomingClient (_http_client.js:565:21)
at HTTPParser.parserOnHeadersComplete (_http_common.js:116:23)
at TLSSocket.socketOnData (_http_client.js:454:20)
at emitOne (events.js:115:13)
at TLSSocket.emit (events.js:210:7)
at addChunk (_stream_readable.js:266:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! puppeteer#0.11.0 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the puppeteer#0.11.0 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! /root/.npm/_logs/2017-10-04T12_32_37_607Z-debug.log
I run the command npm config set PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true to skip download but it wants to download chromium yet.
Any idea to solve this problem?

Try below options;
1) npm config set puppeteer_skip_chromium_download true
2) Add puppeteer_skip_chromium_download=true to .npmrc file where the package.json location
After that run sudo npm install --unsafe-perm=true --allow-root
References;
https://github.com/GoogleChrome/puppeteer/issues/2270
https://medium.com/forcit/seo-for-single-page-applications-8543619e1d0c

upgrade your puppeteer version (optional)
npm set strict-ssl false
npm config set puppeteer_skip_chromium_download true
and npm install again.

try
sudo npm install puppeteer --unsafe-perm=true

Error: spawn EACCES
This roughly means that puppeteer cannot execute Chrome due to permissions issues. If you're having troubles I have a docker image here that you can use and interact with remotely. The issue with Chrome and many linux distros is that installation is quite a challenge to solve.

If you have chrome already you can use system variable to skip installation
https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables

I faced a similar issue when I was using Puppeteer.
I see two parts to your problem,
1. The inability to download Chromium and getting 403 error other is
2. Error: spawn EACCES problem
I'll start with Error: spawn EACCES problem as it's more subtle and tricky
This is because your debian machine doesn't have the required dependencies installed in order to run Puppeteer. These dependencies differ between distributions(CentOS, Ubuntu/Debian etc...).
Follow these steps,
Install all the dependencies required. You can refer this link for the list, https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#chrome-headless-doesnt-launch-on-unix
After all the dependencies are installed, install npm and configure proxy in .npmrc if you are behind a VPC/proxy.
Then, as usual, go ahead with npm i puppeteer and proceed as always
Next to address your inability to download Chromium problem.
Are you behind a proxy? That was my issue.
I noticed on executing npm i puppeteer the script downloads Chromium from an external URL which from your log is https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/499413/chrome-linux.zip
npm is unable to download from this external URL because of the proxy blocking it.
The way I solved this issue was by configuring .npmrc file with the proxy settings
npm config set proxy http://<proxy_username>:<proxy_passowrd>#<proxy_host>:<proxy_port>
npm config set https-proxy http://<proxy_username>:<proxy_passowrd>#<proxy_host>:<proxy_port>
Note:
If your username/password contains any special characters you need to URL encode them. Eg. If your username is bruce\wayne then you need to URL encode it as bruce%5Cwayne where %5C="\"
If your proxy has no authentication then ignore and
Examples:
npm config set proxy http://bruce%5Cwayne:darkknight#11.434.2.23:8080
npm config set https-proxy http://bruce%5Cwayne:darkknight#11.434.2.23:8080
So, try configuring your .npmrc file using the commands given above and then try running npm i puppeteer. The proxy will no longer be blocking the external URL and you would be able to download Chromium.
Let me know if this works and reach out to me if you have any doubts.

I have faced similar issue. The best work around for this is to create a project using npm init, then install puppeteer using command "npm install puppeteer --save". This way chromium also gets installed with out any issues.Hope this helps..

Please set the following in .npmrc
puppeteer_download_host = https://npm.taobao.org/mirrors
or
npm config set puppeteer_download_host https://npm.taobao.org/mirrors

Related

Tailwind CSS Laravel Mix Error - Forces PostCSS 8 to be installed

I recently created a new laravel 8 project using Breeze for the authentication and tailwind css. All worked perfectly when running npm run watch but once I run npm run prod I ran into errors. I noticed that the Tailwind docs mention that there are PostCSS issues so you need to unistall and run
npm install tailwindcss#npm:#tailwindcss/postcss7-compat #tailwindcss/postcss7-compat postcss#^7 autoprefixer#^9
I done that however every time I run npm run prod now the build quits at 98% and says
Additional dependencies must be installed. This will only take a moment.
Running: npm install postcss#^8.1 --save-dev --legacy-peer-deps
npm WARN browser-sync-webpack-plugin#2.2.2 requires a peer of webpack#^1 || ^2 || ^3 || ^4 but none is installed. You must install peer dependencies yourself.
Finished. Please run Mix again.
This auto updates PostCSS to 8.1 every time.
After that if I run npm run prod again it does the exact same message over and over.
I've tried removing the browsersync plugins and trying again but it still doesn't work.
Anyone ran into this or got a solution?
laravel-mix v6 now supports PostCSS8
According to tailwind docs, it suggests to use npm install tailwindcss#npm:#tailwindcss/postcss7-compat #tailwindcss/postcss7-compat postcss#^7 autoprefixer#^9
With the new Mix v6, run npm install tailwindcss#latest postcss#latest autoprefixer#latest
After this, npm run prod will run the way it should.
you must upgrade laravel mix using the following command
npm install laravel-mix#latest
As Digvijay mentioned above the new Mix v6 now supports PostCSS 8. So run:
npm install tailwindcss#latest postcss#latest autoprefixer#latest
After the when you run npm run prod you will still get this message:
Additional dependencies must be installed. This will only take a moment.
Running: npm install browser-sync browser-sync-webpack-plugin#2.2.2 --save-dev --legacy-peer-deps
npm WARN browser-sync-webpack-plugin#2.2.2 requires a peer of webpack#^1 || ^2 || ^3 || ^4 but none is installed. You must install peer dependencies yourself.
Finished. Please run Mix again.
To fix this just add sudo to the front of the npm command it ran:
sudo npm install browser-sync browser-sync-webpack-plugin#2.2.2 --save-dev --legacy-peer-deps
Now run npm run prod and it should work!

Why is my npm install failing on Mac for React Native?

New to React Native I've made sure to install node.js from here and after install I'm told:
Node.js v9.5.0 to /usr/local/bin/node
npm v5.6.0 to /usr/local/bin/npm
I can verify the node version:
node --version: v9.5.0
I ran the documentation's getting started for npm install:
npm install -g create-react-native-app
and also referenced building projects and installed watchman with brew:
watchman 4.9.0
in the terminal ran: npm install -g react-native-cli and terminal: npm start and I get:
grim ~/react-native/react-native npm start
> react-native#1000.0.0 start /Users/grim/React-Native/react-native
> /usr/bin/env bash -c './scripts/packager.sh "$#" || true' --
module.js:557
throw err;
^
Error: Cannot find module 'graceful-fs'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/grim/React-Native/react-native/local-cli/cli.js:12:1)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
grim ~/react-native/react-native
After research I found NPM, cannot find 'graceful-fs', no matter what I do and in terminal ran:
sudo npm install -g graceful-fs
and get:
+ graceful-fs#4.1.11
added 1 package in 0.678s
but when I run npm install I get:
npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! Unsupported URL Type "npm:": npm:babylon#^7.0.0-beta
npm WARN deprecated gulp-util#3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/grim/.npm/_logs/2018-02-08T17_08_50_619Z-debug.log
and in the file log it shows:
116 error code EUNSUPPORTEDPROTOCOL
117 error Unsupported URL Type "npm:": npm:babylon#^7.0.0-beta
so I went to The Problem with gulp-util but when I do:
npm ls gulp-util
I get └── (empty).
Further research I found Why is my npm install not working? but that throws an npm ERR! What am I doing wrong and how can I get npm successfully installed on my Mac running Seirra?
What caused this was trying to test RNTester from the react native repo and it told me:
git clone https://github.com/facebook/react-native.git
cd react-native
npm install
Edit
Per the suggested answer already tried brew install node and was told with a warning node 9.5.0 is already installed so tried brew link node then prompted:
grim ~/react-native/react-native brew link node
Linking /usr/local/Cellar/node/9.5.0...
Error: Could not symlink bin/node
Target /usr/local/bin/node
already exists. You may want to remove it:
rm '/usr/local/bin/node'
To force the link and overwrite all conflicting files:
brew link --overwrite node
To list all files that would be deleted:
brew link --overwrite --dry-run node
so ran brew link --overwrite node.
Edit
Browsing through my files under Users/grim I found a directory with modules in it named node_modules could that be in the wrong location?
Edit
After further research I found Fixing npm On Mac OS X for Homebrew Users and ran:
rm -rf /usr/local/lib/node_modules
brew uninstall node
brew install node --without-npm
echo prefix=~/.npm-packages >> ~/.npmrc
curl -L https://www.npmjs.com/install.sh | sh
modified my ~/.bash_profile with nano:
export PATH="$HOME/.npm-packages/bin:$PATH"
ran npm install and received a missing package.json file so in the terminal did npm init and answered the questions. Went back and pointed to the cloned repo and when I run npm install:
npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! Unsupported URL Type "npm:": npm:babylon#^7.0.0-beta
npm WARN deprecated gulp-util#3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
but if I build a new project with react-native init AwesomeProject and npm install I get:
up to date in 0.416s
and I can point into the project and do react-native run-ios and it works but react-native run-android has to be tweaked in the build.bundle from: classpath 'com.android.tools.build:gradle:2.2.3' to classpath "com.android.tools.build:gradle:2.1.0"
Use Homebrew for Mac as package manager;
https://brew.sh/
then you can run: brew install node
There are many other utilities on this.
create-react-native app does not work with npm 5.
I had the same problem on Windows and downgraded my npm to 4 you can use npm i -g npm#4 to downgrade.
You may try to use yarn command with -W flag (or --ignore-workspace-root-check) which might be helpful.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Regards

'Error: not found: git' code: 'ENOGIT' while installing bower

I'm using windows 10 with git and node installed. Running :
npm install -g bower
resulsts in
npm WARN addRemoteGit Error: not found: git
npm WARN addRemoteGit at F (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:78:19)
npm WARN addRemoteGit sheerun/fs-write-stream-atomic#v1.0.4-fix resetting remote C:\Users\Muhammet Akkus\AppData\Roaming\npm-cache\_git-remotes\git-github-com-sheerun-fs-write-stream-atomic-git-v1-0-4-fix-7baaaaefc7e8a6f2fd1f4fdbc8e4b6e7 because of error: { [Error: not found: git] code: 'ENOGIT' }
npm ERR! git clone --template=C:\Users\Muhammet Akkus\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git://github.com/sheerun/fs-write-stream-atomic.git C:\Users\Muhammet Akkus\AppData\Roaming\npm-cache\_git-remotes\git-github-com-sheerun-fs-write-stream-atomic-git-v1-0-4-fix-7baaaaefc7e8a6f2fd1f4fdbc8e4b6e7: undefined
....
You should try to run this command as root. On Windows, start your CommandLine as administrator and under Mac or Linux use
sudo npm install -g bower
Installing git and running npm install from git-bash worked for me. Make sure you are in the correct directory.
Refer more here for solution
git is not installed or not in the PATH
i use windows and i have same problem when i want to install react-native-router-flux , for me that is solved when i use git bash to install it instead of command line, i hopefully this is help you .

npm install: WARN on dependency

I'm using npm install cmd in my TFS build. I always get the following WARN:
npm WARN optional dep failed, continuing fsevents#0.3.1
How could I delete this warning?
Are you running on Windows or Linux? If so, fsevents cannot be installed, as it is an OSX-only package.
If you run npm with --loglevel=error, you should no longer see this or any other warnings. As far as I know, there is no way to selectively suppress warnings in npm.
The flag -s / --silent works great if you want to remove all warnings and errors:
npm install --silent
npm docs
npm install --no-optional prevents this warning

Installing docpad#6.63 error: No compatible version found: taskgroup#'~3.3.7n'

I'm trying to install docpad and following the guide on: http://docpad.org/docs/install
When I issue the command:
npm install -g docpad#6.63
I get the following npm error:
npm ERR! Error: No compatible version found: taskgroup#'~3.3.7n'
npm ERR! Valid install targets:
npm ERR! ["2.0.0","3.0.0","3.1.0","3.1.1","3.1.2","3.2.0","3.2.2","3.2.3","3.2.4","3.3.0","3.3.1","3.3.2","3.3.3","3.3.4","3.3.5","3.3.6","3.3.7","3.3.8"]
My node version: v0.10.15
My npm version: 1.2.18
I'm running Kubuntu 13.10 with all updates.
I checked if there is an issue reported for this on github, there isn't. Should I report this as an issue or am I doing something wrong?
Same problem here (Kubuntu 13.10).
I sugggest to go back to a previous version of docpad for the moment. On Ubunto/Debian there is another pitfall: some node modules depend on the nodejs executable to be available under node, so you need the additional package nodejs-legacy.
This worked for me:
sudo apt-get install nodejs-legacy
npm install docpad#6.55.6
Bug on DocPad's behalf, that n shouldn't have been there. Now fixed in v6.63.5. Thanks for the report!

Resources