Git Product home page Git Product logo

Comments (8)

jfcere avatar jfcere commented on June 18, 2024 13

Hi @DarkIsDude,

When creating a new project there is actually a problem with the version of @types/jquery that is pulled via @types/materialize-css as it pull on the latest type version which is made for JQuery 3.

This will be fix in 1.5.0 but in the meanwhile the workaround is exactly what you did, install manually the right version of @types/jquery

Using yarn

yarn install @types/[email protected] --save-dev

Or plain npm

npm install @types/[email protected] --save-dev

from ngx-materialize.

jfcere avatar jfcere commented on June 18, 2024 2

@Atticus29 I created a new angular application with the dependencies your provided but I had to make some changes so it can works.

Follow the +/- (green and red highlights) below to see the changes I made and the explanations under the snippet.

package.json

{
  "name": "data-jitsu",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
+   "@angular/animations": "^4.0.0",
    "@angular/common": "^4.0.0",
    "@angular/compiler": "^4.0.0",
    "@angular/core": "^4.0.0",
    "@angular/forms": "^4.0.0",
    "@angular/http": "^4.0.0",
    "@angular/platform-browser": "^4.0.0",
    "@angular/platform-browser-dynamic": "^4.0.0",
    "@angular/router": "^4.0.0",
    "@types/youtube": "0.0.29",
    "angular-froala-wysiwyg": "^2.7.2-1",
    "angular2-materialize": "^15.1.10",
    "core-js": "^2.4.1",
    "hammerjs": "^2.0.8",
-   "jquery": "^2.2.4",
    "materialize-css": "^0.100.2",
    "ng2-materialize": "^1.7.2",
    "ngx-youtube-player": "0.0.41",
    "rxjs": "^5.1.0",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
-   "@angular/cli": "1.0.0",
+   "@angular/cli": "1.5.0",
    "@angular/compiler-cli": "^4.0.0",
    "@types/bootstrap": "^3.3.36",
    "@types/jasmine": "2.5.38",
    "@types/jquery": "^3.2.12",
    "@types/node": "~6.0.60",
    "codelyzer": "~2.0.0",
    "jasmine-core": "~2.5.2",
    "jasmine-spec-reporter": "~3.2.0",
    "karma": "~1.4.1",
    "karma-chrome-launcher": "~2.0.0",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.0",
    "ts-node": "~2.0.0",
    "tslint": "~4.5.0",
-   "typescript": "~2.2.0"
+   "typescript": "~2.3.0"
  }
}

2 versions of jquery installed

You have 2 versions of jquery (2.2.4 because it is specified in the packages.json file and 3.2.12 because it is a dependency of materialize-css) but you won't need 2.2.4 anymore.

typescript version missmatch

@types/jquery requires typescript to be 2.3.0 at least (see reference here). But updating typescript to 2.3.0 means you need to update @angular/cli to 1.5.0 to match the required typescript version for the CLI.

@angular/animations package is missing

In order for the animations to work correctly you will need to install the @angular/animations packages.

Is running npm cache clean --force dangerous?

Not at all, it only removes the already downloaded packages from your disk which mean it will have to download it again next time packages are asked to be installed.

from ngx-materialize.

rsaf avatar rsaf commented on June 18, 2024 1

@jfcere Thanks for your quick response. It's working now.

from ngx-materialize.

CarlosAyala avatar CarlosAyala commented on June 18, 2024

Hi!,
I had the same problem, I fixed it making a new project "ng new [project]" and loading the plugins again with npm.

My package.json

{
  "name": "calendar-club",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^4.0.0",
    "@angular/common": "^4.0.0",
    "@angular/compiler": "^4.0.0",
    "@angular/core": "^4.0.0",
    "@angular/forms": "^4.0.0",
    "@angular/http": "^4.0.0",
    "@angular/platform-browser": "^4.0.0",
    "@angular/platform-browser-dynamic": "^4.0.0",
    "@angular/router": "^4.0.0",
    "core-js": "^2.4.1",
    "mdi": "^1.9.33",
    "ng2-materialize": "^1.4.2",
    "rxjs": "^5.1.0",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "@angular/cli": "1.1.2",
    "@angular/compiler-cli": "^4.0.0",
    "@angular/language-service": "^4.0.0",
    "@types/jasmine": "2.5.45",
    "@types/node": "~6.0.60",
    "codelyzer": "~3.0.1",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "node-sass": "^4.5.3",
    "protractor": "~5.1.2",
    "ts-node": "~3.0.4",
    "tslint": "~5.3.2",
    "typescript": "~2.3.3"
  }
}

And angular-cli

{
    "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
    "project": {
        "name": "calendar-club"
    },
    "apps": [
        {
            "root": "src",
            "outDir": "dist",
            "assets": [
                "assets",
                "favicon.ico"
            ],
            "index": "index.html",
            "main": "main.ts",
            "polyfills": "polyfills.ts",
            "test": "test.ts",
            "tsconfig": "tsconfig.app.json",
            "testTsconfig": "tsconfig.spec.json",
            "prefix": "app",
                "styles": [
                    "styles.scss",
                    "../node_modules/materialize-css/dist/css/materialize.css",
                    "../node_modules/mdi/css/materialdesignicons.css"
                ],
                "scripts": [
                    "../node_modules/jquery/dist/jquery.js",
                    "../node_modules/materialize-css/dist/js/materialize.js"    
                ],
            "environmentSource": "environments/environment.ts",
            "environments": {
                "dev": "environments/environment.ts",
                "prod": "environments/environment.prod.ts"
            }
        }
    ],
    "e2e": {
        "protractor": {
          "config": "./protractor.conf.js"
        }
    },
    "lint": [
        {
            "project": "src/tsconfig.app.json"
        },
        {
            "project": "src/tsconfig.spec.json"
        },
        {
            "project": "e2e/tsconfig.e2e.json"
        }
    ],
    "test": {
        "karma": {
            "config": "./karma.conf.js"
        }
    },
    "defaults": {
        "styleExt": "scss",
        "component": {}
    }
}

from ngx-materialize.

rsaf avatar rsaf commented on June 18, 2024

I' m having this issue after upgrading to the latest version of ng2-materialize.

running npm install @types/[email protected] --save-dev doesn't help.

@jfcere

from ngx-materialize.

jfcere avatar jfcere commented on June 18, 2024

Hi @rsaf,

Since v1.6.0 of ng2-materialize it needs @types/jquery v3.2.12 or higher so no npm install @types/[email protected] --save-dev won't help now.

Can you try to delete your node_modules folder, run npm cache clean and/or yarn cache clean and reinstall your packages?

If this does not fix the issue, please post your package.json file here so we can take a look at your dependencies.

from ngx-materialize.

Atticus29 avatar Atticus29 commented on June 18, 2024

@jfcere Don't know how related this issue is, but I'm getting:
"../node_modules/ng2-materialize/dist/select/select.directive.d.ts (22,29): Generic type 'JQuery<TElement, HTMLElement>' requires 2 type argument(s)." Even after installing @types/jquery v3.2.12 .

Here's my package.json:

{
  "name": "data-jitsu",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "^4.0.0",
    "@angular/compiler": "^4.0.0",
    "@angular/core": "^4.0.0",
    "@angular/forms": "^4.0.0",
    "@angular/http": "^4.0.0",
    "@angular/platform-browser": "^4.0.0",
    "@angular/platform-browser-dynamic": "^4.0.0",
    "@angular/router": "^4.0.0",
    "@types/youtube": "0.0.29",
    "angular-froala-wysiwyg": "^2.7.2-1",
    "angular2-materialize": "^15.1.10",
    "core-js": "^2.4.1",
    "hammerjs": "^2.0.8",
    "jquery": "^2.2.4",
    "materialize-css": "^0.100.2",
    "ng2-materialize": "^1.7.2",
    "ngx-youtube-player": "0.0.41",
    "rxjs": "^5.1.0",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "@angular/cli": "1.0.0",
    "@angular/compiler-cli": "^4.0.0",
    "@types/bootstrap": "^3.3.36",
    "@types/jasmine": "2.5.38",
    "@types/jquery": "^3.2.12",
    "@types/node": "~6.0.60",
    "codelyzer": "~2.0.0",
    "jasmine-core": "~2.5.2",
    "jasmine-spec-reporter": "~3.2.0",
    "karma": "~1.4.1",
    "karma-chrome-launcher": "~2.0.0",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.0",
    "ts-node": "~2.0.0",
    "tslint": "~4.5.0",
    "typescript": "~2.2.0"
  }
}

I don't know how important it is that jquery in dependencies and @types/jquery in devDependencies be the same, but when I tried to make them the same, npm protested, telling me, "npm ERR! notarget No matching version found for jquery@^3.2.12".

Any suggestions welcome!

from ngx-materialize.

Atticus29 avatar Atticus29 commented on June 18, 2024

Also, how dangerout is npm cache clean --force?

from ngx-materialize.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.