Last active
January 4, 2021 01:56
-
-
Save mranawake/ae02efc9518986d023337ee1fd972629 to your computer and use it in GitHub Desktop.
Some random things to fix random things you encounter in life.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Following should fix npm install errors like "stack Error: not found: make" | |
sudo apt-get install build-essential | |
# Elastic Beabstalk temp dployment folder | |
/tmp/deployment/application | |
# Elastic Beabstalk final dployment folder | |
/var/app/current | |
# Following will add /bin/node and /bin/npm symlinks to Beanstalk EC2 based on latest node installation available. | |
sudo ln -sf `ls -td /opt/elasticbeanstalk/node-install/node-* | head -1`/bin/node /bin/node | |
sudo ln -sf `ls -td /opt/elasticbeanstalk/node-install/node-* | head -1`/bin/npm /bin/npm | |
# Above can fail because it goes by folder date. This can cause the glbally available node to be 8x while you actually need 10x. | |
# You can use a specific version instead. | |
sudo ln -sf /opt/elasticbeanstalk/node-install/node-v10.16.3-linux-x64/bin/node /bin/node | |
sudo ln -sf /opt/elasticbeanstalk/node-install/node-v10.16.3-linux-x64/bin/npm /bin/npm | |
# Create or update symlink (use just -s switch to just create) | |
ln -sf /path/to/file /path/to/symlink | |
# Run "npm start" via pm2 | |
pm2 start npm -- start | |
# Uninstall nvm | |
rm -rf $NVM_DIR ~/.npm ~/.bower | |
# Patch sudo node/npm/npx command not found error | |
sudo ln -s "$NVM_DIR/versions/node/$(nvm version)/bin/node" "/usr/local/bin/node" | |
sudo ln -s "$NVM_DIR/versions/node/$(nvm version)/bin/npm" "/usr/local/bin/npm" | |
sudo ln -s "$NVM_DIR/versions/node/$(nvm version)/bin/npx" "/usr/local/bin/npx | |
# Find port usage & kill | |
sudo netstat -tulpn | |
sudo fuser -k <port>/tcp | |
sudo kill -2 <pid> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment