npm WARN puppeteer_sample@1.0.0 No description npm WARN puppeteer_sample@1.0.0 No repository field.
+ eslint@5.16.0 added 100 packages from 63 contributors and audited 234 packages in 17.361s found 0 vulnerabilities
node .\node_modules\eslint\bin\eslint.js --init
? How would you like to use ESLint? To check syntax and find problems ? What type of modules does your project use? CommonJS (require/exports) ? Which framework does your project use? None of these ? Where does your code run? Node ? What format do you want your config file to be in? JSON
どれを選ぶべきか、よくわからないがもっともらしいものを選んだ。
出力フォルダにて動作確認
出力 OUTPUT のプルダウンより ESLint を選択すると、動作中とのことだった。
[Info - 14:47:41] ESLint server stopped.
[Info - 14:47:42] ESLint server running in node v10.2.0
SyntaxError: Unexpected token < at new Script (vm.js:80:7) at createScript (vm.js:274:10) at Object.runInThisContext (vm.js:326:10) at Module._compile (internal/modules/cjs/loader.js:664:28) at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10) at Module.load (internal/modules/cjs/loader.js:600:32) at tryModuleLoad (internal/modules/cjs/loader.js:539:12) at Function.Module._load (internal/modules/cjs/loader.js:531:3) at Function.Module.runMain (internal/modules/cjs/loader.js:754:12) at startup (internal/bootstrap/node.js:283:19)
エラー?サンプルなのに?
puppeteer パッケージをインストール
ファイルの中身をチェックしてみたら、「screenshot.js そのもの」ではなくて、「screenshot.js の解説ページの html ファイル」だった…
Error: Cannot find module 'puppeteer' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15) at Function.Module._load (internal/modules/cjs/loader.js:508:25) at Module.require (internal/modules/cjs/loader.js:637:17) at require (internal/modules/cjs/helpers.js:22:18) at Object.<anonymous> (C:\Users\tombi\Documents\projects\puppeteer\screenshot.js:19:19) at Module._compile (internal/modules/cjs/loader.js:701:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10) at Module.load (internal/modules/cjs/loader.js:600:32) at tryModuleLoad (internal/modules/cjs/loader.js:539:12) at Function.Module._load (internal/modules/cjs/loader.js:531:3)
npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! puppeteer@1.0.0 main: `screenshot.js` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the puppeteer@1.0.0 main script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\tombi\AppData\Roaming\npm-cache\_logs\2019-04-28T01_10_54_431Z-debug.log
npm ERR! code ENOSELF npm ERR! Refusing to install package with name "puppeteer" under a package npm ERR! also called "puppeteer". Did you name your project the same npm ERR! as the dependency you're installing? npm ERR! npm ERR! For more information, see: npm ERR! <https://docs.npmjs.com/cli/install#limitations-of-npms-install-algorithm>
npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\tombi\AppData\Roaming\npm-cache\_logs\2019-04-28T03_05_23_475Z-debug.log
Downloading Chromium r650583 - 144.8 Mb [====================] 100% 0.0s Chromium downloaded to C:\Users\tombi\Documents\projects\puppeteer_sample\node_modules\puppeteer\.local-chromium\win64-650583 npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN puppeteer_sample@1.0.0 No description npm WARN puppeteer_sample@1.0.0 No repository field.
+ puppeteer@1.15.0 added 43 packages from 22 contributors and audited 50 packages in 29.446s found 0 vulnerabilities
npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN diceroller@1.0.0 No description npm WARN diceroller@1.0.0 No repository field.
+ ask-sdk@2.5.1 added 19 packages from 69 contributors and audited 22 packages in 3.509s found 0 vulnerabilities
npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN kidsmorning@1.0.0 No description npm WARN kidsmorning@1.0.0 No repository field.
+ ask-sdk@2.5.1 added 19 packages from 69 contributors and audited 22 packages in 16.431s found 0 vulnerabilities
おお、治ったようだ。
別のパッケージも続けてインストール
npm i -save i18next i18next-sprintf-postprocessor
npm WARN kidsmorning@1.0.0 No description npm WARN kidsmorning@1.0.0 No repository field.
+ i18next@15.0.9 + i18next-sprintf-postprocessor@0.2.2 added 4 packages from 3 contributors and audited 26 packages in 2.668s found 0 vulnerabilities
npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN typescriptsample@1.0.0 No description
+ mocha@6.1.4 + intelli-espower-loader@1.0.1 + power-assert@1.6.1 added 187 packages from 650 contributors and audited 504 packages in 34.575s found 0 vulnerabilities
TypeScript の型定義を導入
npm install -g typings
npm WARN deprecated typings@2.1.1: Typings is deprecated in favor of NPM @types -- see README for more information C:\Users\tombi\AppData\Roaming\npm\typings -> C:\Users\tombi\AppData\Roaming\npm\node_modules\typings\dist\bin.js + typings@2.1.1 added 184 packages from 100 contributors in 16.522s
at Decorator._callFunc (E:\Users\tombi\Projects\TypeScriptSample\node_modules\empower-core\lib\decorator.js:110:20) at Decorator.concreteAssert (E:\Users\tombi\Projects\TypeScriptSample\node_modules\empower-core\lib\decorator.js:103:17) at decoratedAssert (E:\Users\tombi\Projects\TypeScriptSample\node_modules\empower-core\lib\decorate.js:51:30) at powerAssert (E:\Users\tombi\Projects\TypeScriptSample\node_modules\empower-core\index.js:63:32) at Context.<anonymous> (E:\Users\tombi\Projects\TypeScriptSample\test\test2.ts:9:13)
PS E:\Users\tombi\Projects\TypeScriptSample> npm install espower-typescript npm WARN espower-typescript@9.0.2 requires a peer of typescript@>= 2.4.2 but none is installed. You must install peer dependencies yourself. npm WARN ts-node@8.1.0 requires a peer of typescript@>=2.0 but none is installed. You must install peer dependencies yourself. npm WARN typescriptsample@1.0.0 No description
+ espower-typescript@9.0.2 added 8 packages from 5 contributors and audited 743 packages in 2.888s found 0 vulnerabilities