1
1

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 1 year has passed since last update.

Node.js環境構築に関することのメモ

Last updated at Posted at 2022-01-05

個人的メモです。随時追記予定。
Raspberry pi os 64bit(多分ubuntu系)で確認しています。

Node.jsのインストールとアップデート。

$ sudo apt install nodejs
$ sudo apt install npm

nvmでNode.jsをインストールするよりaptでインストールしてnでバージョンをアップデートした方が良い気がした。

$ sudo npm install -g n
#バージョン確認
$ n --stable
$ n --latest
#Node.jsのインストール
$ sudo n latest
#バージョン変更
$ sudo n
#npmのアップデート
$ sudo npm update -g npm

ここで一旦シェルを再起動しましょう!

参考:https://parashuto.com/rriver/tools/updating-node-js-and-npm

Node.jsとnpmの削除

aptでアンインストールできなければこの手で良い...かも。

コンソール
sudo rm -rf /usr/local/bin/npm 
sudo rm -rf /usr/local/share/man/man1/node* 
sudo rm -rf /usr/local/lib/dtrace/node.d
rm -rf ~/.npm
rm -rf ~/.node-gyp
sudo rm -rf /opt/local/bin/node
sudo rm -rf /opt/local/include/node
sudo rm -rf /opt/local/lib/node_modules
sudo rm -rf /usr/local/lib/node*
sudo rm -rf /usr/local/include/node*
sudo rm -rf /usr/local/bin/node*

参考:https://stackoverflow.com/questions/32426601/how-can-i-completely-uninstall-nodejs-npm-and-node-in-ubuntu

知っていると良さそうなこと

便利なモジュール<アプリの実行系>

便利なモジュール<?>系

Playwrightを使う

Rashberry piとJeston Nano。

$ npm install playwright-core
example.js

const playwright = require('playwright-core');

(async () => {
    const browser = await playwright.chromium.launch({executablePath:'/usr/bin/chromium-browser'});
    const context = await browser.newContext();
    const page = await context.newPage();
    await page.goto('https://yahoo.co.jp/');
    await page.screenshot({ path: `example.png` });
    await browser.close();
})();

image.png

1
1
4

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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?