2

I had a static website and I'm trying to kinda convert it into MEAN stack using Angular 5.

I want to add some scripts and styles for galleries, scrolling etc. to my HTML. The scripts need jQuery and I don't have to access them really they just need to run. I added them in the .angular-cli.json like so:

"styles": [
    "styles.css",
    "./src/app/assets/css/font-awesome-4.3.0/css/font-awesome.min.css",
    "./src/app/assets/css/normalize.css",
    "./src/app/assets/css/owl.carousel.css",
    "./src/app/assets/css/owl.theme.css",
    "./src/app/assets/css/main.css",
    "./src/app/assets/css/responsive"
  ],
  "scripts": [
    "./src/app/assets/plugins/jquery-1.11.1.min.js",
    "./src/app/assets/plugins/jquery.smooth-scroll.min.js",
    "./src/app/assets/plugins/imagesloaded.js",
    "./src/app/assets/plugins/owl.carousel.min.js",
    "https://maps.googleapis.com/maps/api/js",
    "./src/app/assets/plugins/jquery.waypoints.min.js",
    "./src/app/assets/plugins/main.js"
  ],

Also added allowJs: true in the tsconfig.app.json

But I get an error when I try to run ng serve or ng build.

Cannot convert undefined or null to object TypeError: Cannot convert undefined or null to object at hasOwnProperty () at Object.hasProperty (/home/robin/webdevelopment/Guenters-Fahrschulen/node_modules/typescript/lib/typescript.js:2229:31) at parseConfig (/home/robin/webdevelopment/Guenters-Fahrschulen/node_modules/typescript/lib/typescript.js:71815:16) at /home/robin/webdevelopment/Guenters-Fahrschulen/node_modules/typescript/lib/typescript.js:71721:22 at Object.parseJsonConfigFileContent (/home/robin/webdevelopment/Guenters-Fahrschulen/node_modules/typescript/lib/typescript.js:71735:11) at Object.readTsconfig (/home/robin/webdevelopment/Guenters-Fahrschulen/node_modules/@angular/cli/utilities/read-tsconfig.js:8:32) at new NgCliWebpackConfig (/home/robin/webdevelopment/Guenters-Fahrschulen/node_modules/@angular/cli/models/webpack-config.js:19:42) at Class.run (/home/robin/webdevelopment/Guenters-Fahrschulen/node_modules/@angular/cli/tasks/serve.js:71:29) at check_port_1.checkPort.then.port (/home/robin/webdevelopment/Guenters-Fahrschulen/node_modules/@angular/cli/commands/serve.js:123:26) at at process._tickCallback (internal/process/next_tick.js:160:7)

My linter also throws an error on $(document).ready(); but how would I replace it?

Mika Sundland
  • 18,120
  • 16
  • 38
  • 50
Fluqz
  • 349
  • 1
  • 4
  • 17
  • It's a long story, you may try to start from [How to use jQuery with TypeScript](https://stackoverflow.com/questions/32050645/how-to-use-jquery-with-typescript) – dhilt Jan 07 '18 at 21:55
  • Now I get this: An error occured during the build: Error: ENOENT: .../src/app/assets/plugins/jquery-1.11.1.min.js', but the path is correct – Fluqz Jan 07 '18 at 22:02

0 Answers0