Npm node-http2 error ENOENT

I started up an existing full stack project on a new ubuntu installation. I ran npm install and bower install and on grunt serve I kept getting a similar error to this:

npm ERR! enoent ENOENT: no such file or directory

The error seemed to be triggered by node-http2 specifically.

I tried several approaches, I upgraded node, upgraded grunt. I uninstalled and reinstalled. Cleared cache.

What I finally realised the problem was, I needed to install yo. The project had been created using the yeoman generator.

Checklist:

  • Make sure npm is installed
  • Make sure bower is installed
  • Make sure grunt is installed
  • Make sure yo is installed

These are some additional commands I ran

Clear npm cache and reinstall npm

sudo npm cache clean -f

sudo npm install -g n

sudo n stable

 

Deleted the \tmp folder and receiving “bash: cannot create temp file for here-document: Permission denied” Error

I was trying to delete ~/tmp folder and accidentally deleted the /tmp folder. Then when I tried to ls a folder structure I kept getting this error:

bash: cannot create temp file for here-document: Permission denied

To fix the error I ran the following commands:

1
2
3
4
5
6
7
cd /

mkdir tmp

sudo chown root:root /tmp

sudo chmod 1777 /tmp

 

Laravel seeds error ReflectionException “Class does not exist error”

When I ran the following artisan seed command, I received an error:

php artisan db:seed

I kept receiving the following error:

[ReflectionException]
Class XTableSeeder does not exist

This command helped fix the error:

composer dump-autoload

Also check that you have a Seeder file in /database/seeds/

eg XTableSeeder.php

With content similar to this

<?php

use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
use App\User;

class RoleTableSeeder extends Seeder {

public function run() {
DB::table(‘x’)->delete();
DB::table(‘x’)->insert([

]);

}

And make sure you have added the call in the DatabaseSeeder.php file:

$this->call(‘XTableSeeder’);

Setting up putty on windows to ssh into a server without logging in each time

I often need to ssh onto a linux server from windows. Putty offers this ability. It is quick and easy to use. The only obstacle has been loggin in to the server each time. Below is the instructions to let putty automatically log you in and on to a server.

Download putty

You need to use Putty on windows to ssh into a server, use the following link to download putty.exe

http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

 

Downloading PuttyGen

You need to use PuttyGen to generate a key, use the following link to download puttygen.exe

http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

Use PuttyGen to generate an ssh key for windows

Open PuttyGen and generate a key by clicking the “Generate” button. Move your mouse around to generate the key.

puttygen-screen

Then you can click “Save public key” and save you public key somewhere safe. Click “Save private key” and save if somewhere save.

puttygen-example

Note the Parameter “Type of key to generate” can be se to SSH-2 RSA and the Number of bits to 2048.

Copy the ssh key (you will add this to the server). And put it in notepad so you can use it later, after you have followed the below steps.

Set up putty to ssh into a linux server using a windows computer

Open putty

And do the following:

Step 1: Session

On the first screen, “Session” insert your serer’s IP Adress or Host Name. Port is usually 22 by default. And connection type is usually set to ssh. (Don’t click open yet)

putty-example-1

Step 2: Connection- Data

In the login details, insert the Auto-login username field with your server username. Eg “root”. (Don’t click open yet)

putty-example-2

Step 3: Connection – SSH – Auth

In the Auth section browser for the private key file you saved above. It should be a *.ppk file. (Don’t click open yet)

putty-example-3

Step 4: Save these settings. Session.

Now that you’ve set it up, make sure to save it so you don’t have to go through this process each time.

Go back to the Session section, and click on the Save button. (Don’t click open yet)

putty-example-4

Step 5: Open – Now you can click open

Once you are done setting it up, click “Open”. This will open a connection with the server in a new console window.

Add the ssh key to the server

Once you have a connection with the server you can type the following command:

sudo nano ~/.ssh/authorized_keys

Paste the full key you copied in a new line in this file.

ssh-rsa ….

If there are existing keys don’t replace those, just add to a new line.

Then ctr + X. And insert “Y” to save.

Check you have saved the above steps:

To exit the server connection click Ctrl + D. And this will close the window.

Then open putty again, load your server entry you just made, and click open.

You should now be automatically logged in.