Categories
Fixing Stuff Laravel Samuel

Fixing NPM Run Watch Error

Today we are getting this error on a Laravel site:

To fix this issue we are going to do the following:

  • delete the node_modules folder
  • delete package-lock.json file
  • run: npm install
  • open the .env file and make sure our environments line up with the script we are trying to run- IE make sure “npm watch” is set to work with the environment we are currently on. In this case “npm dev” was set to local and “npm watch” was set to staging.
  • Run: npm run dev locally to confirm it works.
  • Run: npm run watch on the staging site to confirm it works

Now we need to add a migration to get a portion of the site working with a new DB column, for this we will run:

  • php artisan make:migration create_payment_status_column
  • inside of the migration file we will add:
class CreatePaymentStatusColumn extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('companies', function (Blueprint $table) {
            $table->enum('payment_status',['trail', 'active', 'inactive'])->default('trail');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        $table->dropColumn('payment_status');
    }
}