npm ERR! code ENOTFOUND npm ERR! errno ENOTFOUND npm ERR! network request to https://registry.npmjs.org/puppeteer failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443 npm ERR! network This is a problem related to network connectivity. npm ERR! network In most cases you are behind a proxy or have bad network settings. npm ERR! network npm ERR! network If you are behind a proxy, please make sure that the npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in: npm ERR! C:Users ombiAppDataRoaming pm-cache_logs9-05-08T03_28_28_136Z-debug.log
npm ERR! path P:projectspuppeteer_sample ode_modulesminimistpackage.json.3444437947 npm ERR! code EPERM npm ERR! errno -4048 npm ERR! syscall rename npm ERR! Error: EPERM: operation not permitted, rename 'P:projectspuppeteer_sample ode_modulesminimistpackage.json.3444437947' -> 'P:projectspuppeteer_sample ode_modulesminimistpackage.json' (中略) npm ERR! The operation was rejected by your operating system. npm ERR! It's possible that the file was already in use (by a text editor or antivirus), npm ERR! or that you lack permissions to access it. npm ERR! npm ERR! If you believe this might be a permissions issue, please double-check the npm ERR! permissions of the file and its containing directories, or try running npm ERR! the command again as root/Administrator (though this is not recommended).
OSに拒否されて、ファイルをリネームできないとのこと。
インストール先の P ドライブがローカルではなく、ネットワーク上のドライブであることが関係しているのかもしれない。
職場のネットワークドライブのアクセス権限を変更することはできないので、お奨めしない not recommended と書かれてはいるが「管理者として実行」することにした。(command again as root/Administrator 相当)
Downloading Chromium r650583 - 144.8 Mb [====================] 100% 0.0s Chromium downloaded to P:projectspuppeteer_sample ode_modulespuppeteer.local-chromiumwin64-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 6 packages from 6 contributors and audited 50 packages in 610.199s found 0 vulnerabilities
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