Use puppeteer-core and installing chromium manually - chromium

By including the puppeteer package, you automatically download and install Chromium which is ~200MB download.
But puppeteer is just one component of our repo, and some users may want to clone and run commands in our repo without downloading the entire Chromium bundle. Basically, it's an opt-in subset of the repo.
Now this is all well and good, they provide the useful puppeteer-core package which doesn't bundle Chromium. Awesome.
But how do I manually install Chromium so that puppeteer-core finds it? I just get the following error no matter what I try (e.g. globally installing puppeteer).
Chromium revision is not downloaded.
I'm using yarn if that affects anything. A nice simple brew and apt command would be super useful here, but I'd even write a quick bash/node script to handle the installation if need be.

You can manually download Chromium (e.g. via this page or this page) and then set the executablePath when launching it:
const browser = await puppeteer.launch({
executablePath: 'path/to/your/chrome.exe'
});
Check out this issue on the puppeteer github repository for more information on what to download from where.

Related

Vue CLI: What exactly happens when I use "npm install"?

I've been using the command line for some time now, but I'm still not sure what exactly happens when I do certain things - and I'm not sure what to google for help.
When I'm working with Anaconda and Python, I found the environments I created in C:\Users\<User>\Anaconda3\envs. And every python package I install in an environment seems to go there. Great!
But how does this work outside of Anaconda/Python? For example, I installed the vue CLI via npm install -g #vue/cli. What exactly happens when I do this; or more precicely, where are files saved?
During the creation of a new vue project, a readme.md is created as well. It states that users should simply npm install to setup the project. It seems that this command installs all packages stated in the package.json. I would like to try out if this command works for new users, but I already (obviously) have everything installed. Can I create some kind of environment (like I do with Anaconda for Python) to accomplish this?
Thanks a lot for your answers!

How to fix errors in Gridsome.js?

Problem Summary
So I'm trying to launch a new Gridsome project for local development. I've toyed with Gridsome in the past and had a great experience, so I decided to give it another shot.
This time around; however, when I run the gridsome create command, the system creates a new Gridsome site directory as expected but returns the following error message:
The instructions in this error message say to enter the newly-created site directory and run gridsome develop to start local development. However, after running cd my-gridsome-site and subsequently running gridsome develop, I then receive this error:
So far, I've tried running npm install --save from the site directory as well as yarn install, both to no avail. Thinking that this was possibly tied to my terminal, I switched from using the Zsh terminal to using the Bash terminal. This also did not work.
I'm at a loss here and could really use a hand.
Thank you for helping,
David
This seems to be an environment error. Gridsome requires Node.js (v8.3+) and recommends Yarn.
Make sure your Node.js version is v8.3+ and use only one package manager like Yarn.
to check node version: node -v
I had this same issue, but I resolved it after installing yarn and running the project with yarn instead of NPM. So you should try using yarn it will help,

Error using zef to install Twitter module

I'm using zef to install the Twitter module with zef install Twitter
I'm getting the following error:
Enabled fetching backends [git path curl wget] don't understand git://github.com/raku-community-modules/Twitter You may need to configure one of the following backends, or install its underlying software - [pswebrequest]
I've googled 'pswebrequest' and I'm not getting anything of note.
I've tried installing HTTP::Tinyish, one of the dependencies, to check that my zef installation is working properly, and that was fine.
Any pointers on how to fix this?
The source-url should end with .git if its a git repository, as the backends use extensions to figure out how/what is needed to fetch/extract various types of packaged distributions.
You could open a pull request to add the .git to the source-url, or you could work around it manually via:
zef install https://github.com/raku-community-modules/Twitter.git

npm/bower - Basic questions(Why it requires for just AngularJS then?)

I read about npm and bower, differences, usage, how it works, purpose as well. All explanation says that to work in NodeJs. But when I searched for AngularJS2, the tutorial says use npm. I have some basic questions based upon the understanding that npm basically for dependency management or packages to be installed.
How my Java/Eclipse workspace knows that npm installed the particular JS library/file, what path should be given in the html/web page for including those files/libraries?
If I move the web application to production, how will the server gets those dependent libraries? Even if server gets it, it might be installed in different folder. Basically how it can be managed with a web applications in different environments for just AngularJS app?
Can anyone please help me to have better understanding?
Finally found the answer. NPM is node package manager which helps basically to download the dependencies (almost like maven, gradle in java).
npm software needs to be installed in developer's machine.
Add the required dependencies in the package.json in the root folder of AngularJS application.
Open the DOS command line and navigate to project root folder(workspace/project in eclipse), then type npm install which will download all the dependencies mentioned in the package.json to a folder called npm_modules inside project folder.
The other and important advantage is npm can be used to install browser agent as well. So npm start command will open the browser and will load the application automatically in browser. Developer does not need to be aware about NodeJs. One more benefit of using this approach is the browser will get refreshed automatically when any update in the JS file gets saved.

Can I download an NPM package without the npm tool?

I want to download https://npmjs.org/package/ripple-lib for inspection. Most other systems I have dealt with provide a download link as well as the command install package syntax. The npm site does not seem to provide such a download link. Does anyone know another way?
Download it from the github repository, which is linked on the page.