1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

10分ではじめるpuppeteer

Posted at
Terminal
brew install nodebrew

$ echo 'export PATH=$HOME/.nodebrew/current/bin:$PATH' >> ~/.bash_profile
$

$ mkdir -p ~/.nodebrew/src
$ cd ~


$ nodebrew install-binary latest
Fetching: https://nodejs.org/dist/v12.10.0/node-v12.10.0-darwin-x64.tar.gz
######################################################################## 100.0%
Installed successfully

$ nodebrew use v12.10.0
use v12.10.0

$ node -v
v12.9.0

$ npm install --save puppeteer

> puppeteer@1.20.0 install /Users/%user%/node_modules/puppeteer
> node install.js

Downloading Chromium r686378 - 110.2 Mb [====================] 100% 0.0s 
Chromium downloaded to /Users/%user%/node_modules/puppeteer/.local-chromium/mac-686378
npm WARN saveError ENOENT: no such file or directory, open '/Users/%user%/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/Users/%user%/package.json'
npm WARN %user% No description
npm WARN %user% No repository field.
npm WARN %user% No README data
npm WARN %user% No license field.

+ puppeteer@1.20.0
added 43 packages from 22 contributors and audited 50 packages in 11.012s
found 0 vulnerabilities


saveError ENOENT: no such file or directory, open '/Users/%user%/package.json'
package.jsonが存在していない


$ npm init --yes
Wrote to /Users/%user%/package.json:

{
  "name": "%user%",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "dependencies": {
    "puppeteer": "^1.20.0"
  },
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}




   ╭────────────────────────────────────────────────────────────────╮
   │                                                                │
   │      New minor version of npm available! 6.10.3 → 6.11.3       │
   │   Changelog: https://github.com/npm/cli/releases/tag/v6.11.3   │
   │               Run npm install -g npm to update!                │
   │                                                                │
   ╰────────────────────────────────────────────────────────────────╯

$ ls package.json
package.json


$ npm install --save puppeteer

> puppeteer@1.20.0 install /Users/%user%/node_modules/puppeteer
> node install.js

Downloading Chromium r686378 - 110.2 Mb [====================] 100% 0.0s 
Chromium downloaded to /Users/%user%/node_modules/puppeteer/.local-chromium/mac-686378
npm WARN %user%@1.0.0 No description
npm WARN %user%@1.0.0 No repository field.

+ puppeteer@1.20.0
updated 1 package and audited 50 packages in 9.048s
found 0 vulnerabilities

$ cd puppeteer/
$ node scraping_google_co_jp.js 
$

正常に動作!
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?