NodeJS: Difference between revisions
Jump to navigation
Jump to search
(35 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
==Keyring== | |||
'''Node Source:''' | |||
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key\ | |||
| sudo gpg --dearmor -o /usr/share/keyrings/nodesource.gpg | |||
cat << EOF | sudo tee /etc/apt/sources.list.d/nodesource.list >/dev/null | |||
deb [arch=$(dpkg --print-architecture)\ | |||
signed-by=/usr/share/keyrings/nodesource.gpg]\ | |||
https://deb.nodesource.com/node_18.x $(lsb_release -cs) main | |||
deb-src [arch=$(dpkg --print-architecture)\ | |||
signed-by=/usr/share/keyrings/nodesource.gpg]\ | |||
https://deb.nodesource.com/node_18.x $(lsb_release -cs) main | |||
EOF | |||
'''Yarn:''' | |||
curl -fsSL https://dl.yarnpkg.com/debian/pubkey.gpg\ | |||
| sudo gpg --dearmor -o /usr/share/keyrings/yarnkey.gpg | |||
cat << EOF | sudo tee /etc/apt/sources.list.d/yarn.list >/dev/null | |||
deb [arch=$(dpkg --print-architecture)\ | |||
signed-by=/usr/share/keyrings/yarnkey.gpg]\ | |||
https://dl.yarnpkg.com/debian stable main | |||
EOF | |||
== NVM == | == NVM == | ||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39. | curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash | ||
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39. | wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash | ||
/usr/local/lib | /usr/local/lib | ||
Line 23: | Line 49: | ||
== Code Server == | == Code Server == | ||
{| | |||
| valign="top" | | |||
nvm use 14 | nvm use 14 | ||
npm install -g yarn | npm install -g yarn | ||
yarn global add code-server | yarn global add code-server | ||
| valign="top" | | |||
~/.yarn/bin/code-server | ~/.yarn/bin/code-server | ||
mkdir -p ~/.local/share/code-server/logs | |||
vim ~/.config/code-server/config.yaml | vim ~/.config/code-server/config.yaml | ||
|- | |||
| colspan="2" | | |||
---- | |||
|- | |||
| valign="top" | | |||
<source lang="properties"> | |||
bind-addr: 127.0.0.1:8080 | |||
auth: none | |||
password: academia | |||
cert: false | |||
</source> | |||
| valign="top" | | |||
<source lang="properties"> | <source lang="properties"> | ||
bind-addr: | bind-addr: 127.0.0.1:8080 | ||
auth: | auth: password | ||
password: academia | password: academia | ||
cert: false | cert: false | ||
</source> | </source> | ||
|- | |||
| colspan="2" | | |||
---- | |||
|- | |||
| colspan="2" valign="top" | | |||
ln -s /home/pi/.yarn/bin/code-server /usr/local/bin/code-server | |||
sudo vim /etc/systemd/system/code-server.service | |||
<source lang="ini"> | |||
[Unit] | |||
Description=code-server | |||
After=network.target | |||
[Service] | |||
User=pi | |||
Group=pi | |||
WorkingDirectory=/home/pi | |||
Environment="PATH=/usr/bin" | |||
ExecStart=/usr/local/bin/code-server | |||
[Install] | |||
WantedBy=multi-user.target | |||
</source> | |||
sudo systemctl disable code-server.service | |||
sudo systemctl enable code-server.service | |||
sudo systemctl status code-server.service | |||
sudo systemctl start code-server.service | |||
sudo systemctl stop code-server.service | |||
'''blink » config » Hosts » New Host » SSH Config » New Host » Save''' | |||
# Compression no | |||
LocalForward 8080 127.0.0.1:8080 | |||
ExitOnForwardFailure yes | |||
|} | |||
== Firewall == | == Firewall == | ||
Line 44: | Line 124: | ||
ufw enable | ufw enable | ||
ufw status | ufw status | ||
== Knowledge == | |||
npm config set legacy-peer-deps true | |||
npm install --legacy-peer-deps | |||
sudo npm install -g --unsafe-perm=true --allow-root | |||
curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash - | |||
curl -fsSL https://deb.nodesource.com/setup_19.x | sudo -E bash - | |||
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - | |||
curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash - | |||
== References == | == References == | ||
{| | |||
| valign="top" | | |||
* [https://scotch.io/tutorials/getting-started-with-node-express-and-postgres-using-sequelize Getting Started with Node, Express and Sequelize] | * [https://scotch.io/tutorials/getting-started-with-node-express-and-postgres-using-sequelize Getting Started with Node, Express and Sequelize] | ||
* [https://techcraft.co/videos/2022/2/vscode-on-ipad-pro-full-setup-guide-with-raspberry-pi/ VSCode on iPad Pro With Raspberry Pi] | * [https://techcraft.co/videos/2022/2/vscode-on-ipad-pro-full-setup-guide-with-raspberry-pi/ VSCode on iPad Pro With Raspberry Pi] | ||
Line 56: | Line 148: | ||
* [[VSCode]] | * [[VSCode]] | ||
* [[Fedora]] | * [[Fedora]] | ||
| valign="top" | | |||
* [https://github.com/nodesource/distributions/blob/master/README.md NodeSource Node.js Binary Distributions for Linux] | |||
* [https://www.npmjs.com/package/n Interactively Manage Your Node.js Versions » <code>n</code>] | |||
* [https://nodejs.org/en/download/package-manager/ Installing Node.js via Linux Package Manager] | |||
* [https://www.digitalocean.com/community/tutorials/how-to-set-up-the-code-server-cloud-ide-platform-on-ubuntu-20-04 VSCode Cloud IDE Platform on Ubuntu 20.04] | |||
* [https://serverfault.com/questions/957084/ EXEC Spawning Permission denied] | |||
* [https://stackoverflow.com/questions/38323880/ Error: EACCES: permission denied] | |||
* [https://discussions.apple.com/thread/252596486 iPad Pro Disable Virtual Keyboard] | |||
* [[VS Code on iPad Pro]] | |||
* [[Raspberry Pi]] | |||
* [[Theia]] | |||
| valign="top" | | |||
* [https://stackoverflow.com/questions/48440673/ Switch Between Terminals in VSCode] | |||
* [https://serverfault.com/questions/283129/ SSH Connection Hang Forever] | |||
* [[NPM]] | |||
* [[Yarn]] | |||
|} |
Latest revision as of 21:01, 18 December 2022
Keyring
Node Source: curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key\ | sudo gpg --dearmor -o /usr/share/keyrings/nodesource.gpg cat << EOF | sudo tee /etc/apt/sources.list.d/nodesource.list >/dev/null deb [arch=$(dpkg --print-architecture)\ signed-by=/usr/share/keyrings/nodesource.gpg]\ https://deb.nodesource.com/node_18.x $(lsb_release -cs) main deb-src [arch=$(dpkg --print-architecture)\ signed-by=/usr/share/keyrings/nodesource.gpg]\ https://deb.nodesource.com/node_18.x $(lsb_release -cs) main EOF
Yarn: curl -fsSL https://dl.yarnpkg.com/debian/pubkey.gpg\ | sudo gpg --dearmor -o /usr/share/keyrings/yarnkey.gpg cat << EOF | sudo tee /etc/apt/sources.list.d/yarn.list >/dev/null deb [arch=$(dpkg --print-architecture)\ signed-by=/usr/share/keyrings/yarnkey.gpg]\ https://dl.yarnpkg.com/debian stable main EOF
NVM
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
/usr/local/lib ├── [email protected] └── [email protected]
If you wish to uninstall them at a later point (or re-install them under your nvm
Nodes), you can remove them from the system Node as follows:
nvm use system npm uninstall -g a_module sudo npm uninstall -g nvm
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
nvm install 14 && node -v nvm use system && node -v nvm use 14
Code Server
nvm use 14 npm install -g yarn yarn global add code-server |
~/.yarn/bin/code-server mkdir -p ~/.local/share/code-server/logs vim ~/.config/code-server/config.yaml |
| |
bind-addr: 127.0.0.1:8080
auth: none
password: academia
cert: false
|
bind-addr: 127.0.0.1:8080
auth: password
password: academia
cert: false
|
| |
ln -s /home/pi/.yarn/bin/code-server /usr/local/bin/code-server sudo vim /etc/systemd/system/code-server.service [Unit]
Description=code-server
After=network.target
[Service]
User=pi
Group=pi
WorkingDirectory=/home/pi
Environment="PATH=/usr/bin"
ExecStart=/usr/local/bin/code-server
[Install]
WantedBy=multi-user.target
sudo systemctl disable code-server.service sudo systemctl enable code-server.service sudo systemctl status code-server.service sudo systemctl start code-server.service sudo systemctl stop code-server.service blink » config » Hosts » New Host » SSH Config » New Host » Save # Compression no LocalForward 8080 127.0.0.1:8080 ExitOnForwardFailure yes |
Firewall
uncomplicated firewall(ufw): systemctl status ufw ufw status verbose ufw disable ufw enable ufw status
Knowledge
npm config set legacy-peer-deps true npm install --legacy-peer-deps
sudo npm install -g --unsafe-perm=true --allow-root curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash - curl -fsSL https://deb.nodesource.com/setup_19.x | sudo -E bash - curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -