rd-dev-ukraine / angular-io-slimscroll

Customizable slimScroll directive for Angular 2.
MIT License
18 stars 19 forks source link

I can't import this library #4

Closed kakalos12 closed 7 years ago

kakalos12 commented 7 years ago

I'm using angular-cli and while I import this libary, it says "Cannot find module 'angular-io-slimscroll'". Please help. Below is my package.json. { "name": "inspinia", "version": "2.7.0", "license": "Wrapbootstrap", "angular-cli": {}, "scripts": { "start": "ng serve", "lint": "tslint \"src/**/*.ts\"", "test": "ng test", "pree2e": "webdriver-manager update", "e2e": "protractor" }, "private": true, "dependencies": { "@angular/common": "latest", "@angular/compiler": "latest", "@angular/core": "latest", "@angular/forms": "latest", "@angular/http": "latest", "@angular/platform-browser": "latest", "@angular/platform-browser-dynamic": "latest", "@angular/router": "latest", "angular-io-slimscroll": "^1.0.0", "angular2-ladda": "latest", "animate.css": "3.5.2", "bootstrap": "latest", "core-js": "latest", "font-awesome": "latest", "jquery": "latest", "metismenu": "latest", "ng2-summernote": "latest", "rxjs": "latest", "toastr-ng2": "latest", "ts-helpers": "latest", "zone.js": "0.7.6" }, "devDependencies": { "@types/jasmine": "2.5.41", "@types/node": "7.0.4", "angular-cli": "1.0.0-beta.26", "codelyzer": "2.0.0-beta.4", "jasmine-core": "latest", "jasmine-spec-reporter": "3.2.0", "karma": "1.4.1", "karma-chrome-launcher": "latest", "karma-cli": "latest", "karma-jasmine": "latest", "karma-remap-istanbul": "0.4.0", "protractor": "latest", "ts-node": "2.0.0", "tslint": "4.4.2", "typescript": "latest" } }

And here is the error log : odule build failed: Error: C:/Users/Dong/Documents/projects/ses-angular/src/app/app.module.ts (22,28): Cannot find module 'angula r-io-slimscroll'.) at _checkDiagnostics (C:\Users\Dong\Documents\projects\ses-angular\node_modules\@ngtools\webpack\src\loader.js:145:15) at C:\Users\Dong\Documents\projects\ses-angular\node_modules\@ngtools\webpack\src\loader.js:172:17 @ ./src/app/index.ts 2:0-29 @ ./src/main.ts @ multi webpack-dev-server/client?http://localhost:4200/ ./src/main.ts

While I open the slimscroll.directive.ts, there is un error sayings that

Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.

rd-dev-ukraine commented 7 years ago
  1. You have typo in importing the directive Cannot find module 'angula r-io-slimscroll'
  2. You need to add "experimentalDecorators": true to your tsconfig.json
kakalos12 commented 7 years ago
{
  "compilerOptions": {
    "declaration": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": ["es6", "dom"],
    "mapRoot": "./",
    "module": "es6",
    "moduleResolution": "node",
    "outDir": "../dist/out-tsc",
    "sourceMap": true,
    "target": "es5",
    "typeRoots": [
      "../node_modules/@types"
    ]
  }
}

This is my tsconfig.json. And below is my error. image

kakalos12 commented 7 years ago

This is what when I re-install the library image

kakalos12 commented 7 years ago

just upgrade packages to latest version and the library resolution is ok. But this error occurs. image

Omikhleia commented 7 years ago

For the record, your remaining error seems to be related to AOT and apparently experienced by other packages as well, see e.g. https://github.com/angular/angular-cli/issues/3707

(Probably unrelated note: By the way, why do you have SlimScroll in the "imports" section of your NgModule, in your screenshot, rather than in the "descriptions" section, as per the documentaton ?)

kakalos12 commented 7 years ago

Thanks Omikhleia, I put the SlimScroll in the declarations and it's working fine now.

Thanks

kakalos12 commented 7 years ago

Hi, the problem persists when I use the ng serve --prod command. I checked https://github.com/angular/angular-cli/issues/3707 and see that the module should publish the metadata. I don't know much about it. I checked some modules that I used in my project and see that they have the metadata.json but angular-io-slimroll. Any solutions ?

rd-dev-ukraine commented 7 years ago

@kakalos12 SlimScroll isn't a module. There is no need for metadata