Search code examples
angularngx-bootstrap

ngx-bootstrap ERROR Error: Uncaught (in promise): TypeError: v is not a function


I have two environments where I run my app and this component works on one, but not the other.

I import as follows in package.json

"ngx-bootstrap": "^1.7.1",

(I recently tried upgrading from "ng2-bootstrap": "^1.6.1", to try and fix the issue). In app.module, I import as follows:

import { TimepickerModule } from 'ngx-bootstrap/timepicker';

I import this module in the imports as follows:

TimepickerModule.forRoot(),

Within a reactive form:

<timepicker formControlName="startTime" name="startTime" id="startTime"></timepicker>

In the ts component:

 this.activityForm = this.fb.group({
            ...
            startTime: ['', ''],
            ...
        });

where ... in place of fields not relevant to this question. It works fine, with a template form, but I am looking to move to reactive forms. The reactive form works on one machine, but not another.


Solution

  • Try deleting the node_modules folder on machine it doesn't work and run npm install again and see if it works. Steps:

     - Close the IDE, delete the folder manually. 
     - Open IDE run "npm cache clean". 
     - Then run npm install.
    

    Hope it helps!