Karma: After upgrade to ionic 3: ERROR in ./src/+some.component.ts (20,15): error TS2304: Cannot find name 'require'

ERROR in ./src/+some.component.ts (20,15): error TS2304: Cannot find name 'require'.

That is what Webpack throws when I do

karma start ./test-config/karma.conf.js

But: We have not one single require in the entire app.

declare var require: any;

=)

1 Like

Resolved by removing @types/jasmine and other test-related types from package.json

This declare was useful to get rid of the TS2304: Cannot find name ‘require’ error when I installed a needed Node

Glad to help! It’s come up so often for me on projects.

1 Like