require is not defined in javascript while running javascrit code example Example: require is not defined remove "type": "module" from package.json