seiyria / ng2-fontawesome

An easy-to-use directive for font awesome icons.
MIT License
20 stars 3 forks source link

error TS2307: Cannot find module 'ng2-fontawesome'. #3

Open iamandersonp opened 8 years ago

iamandersonp commented 8 years ago

i'm using a fresh install of the angular2-seed and affthe the process of install ing the module i'm getting the error

error TS2307: Cannot find module 'ng2-fontawesome'.

seiyria commented 8 years ago

Going to need to see a snippet, because it works for me.

iamandersonp commented 8 years ago

well here is my package.json

"dependencies": { "@angular/common": "2.0.0-rc.5", "@angular/compiler": "2.0.0-rc.5", "@angular/core": "2.0.0-rc.5", "@angular/http": "2.0.0-rc.5", "@angular/platform-browser": "2.0.0-rc.5", "@angular/platform-browser-dynamic": "2.0.0-rc.5", "@angular/platform-server": "2.0.0-rc.5", "@angular/router": "3.0.0-rc.1", "angular2-jwt": "0.1.16", "bootstrap": "^3.3.6", "core-js": "^2.4.0", "es6-promise": "^3.1.2", "es6-shim": "^0.33.13", "es7-reflect-metadata": "^1.6.0", "jwt-decode": "^2.0.1", "ng2-fontawesome": "0.0.4", "rxjs": "5.0.0-beta.6", "zone.js": "~0.6.12" }, "devDependencies": { "css-loader": "^0.23.1", "exports-loader": "^0.6.3", "expose-loader": "^0.7.1", "file-loader": "^0.9.0", "imports-loader": "^0.6.5", "json-loader": "^0.5.4", "less": "^2.7.1", "less-loader": "^2.2.3", "ng2-fontawesome": "0.0.4", "raw-loader": "^0.5.1", "style-loader": "^0.13.1", "ts-loader": "^0.8.1", "tsconfig-lint": "^0.7.0", "tslint": "^3.7.1", "tslint-loader": "^2.1.3", "typedoc": "^0.4.3", "typescript": "~1.8.10", "typings": "^1.3.0", "url-loader": "^0.5.7", "webpack": "^1.13.1", "webpack-dev-server": "^1.14.1" }

this is the webpack.conf.js

var sliceArgs = Function.prototype.call.bind(Array.prototype.slice); var toString = Function.prototype.call.bind(Object.prototype.toString); var path = require('path'); var webpack = require('webpack'); // Webpack Plugins var CommonsChunkPlugin = webpack.optimize.CommonsChunkPlugin;

module.exports = { devtool: 'source-map', // devtool: 'eval',

// entry: { 'vendor': [ // Polyfills 'core-js/es6', 'core-js/es7/reflect', 'zone.js/dist/zone', 'zone.js/dist/long-stack-trace-zone', // Angular2 '@angular/common', '@angular/platform-browser', '@angular/platform-browser-dynamic', '@angular/core', '@angular/router', '@angular/http', // RxJS 'rxjs', // Other 'angular2-jwt', 'ng2-fontawesome' ], 'app': [ './src/index' ] },

// Config for our build files output: { path: root('build'), filename: '[name].js', // filename: '[name].[hash].js', sourceMapFilename: '[name].js.map', chunkFilename: '[id].chunk.js' // publicPath: 'http://mycdn.com/' },

resolve: { root: __dirname, extensions: [ '', '.ts', '.js', '.json', '.css', '.html' ] },

module: { preLoaders: [ { test: /.ts$/, loader: 'tslint-loader' } ], loaders: [ // Support for .ts files. { test: /.ts$/, loader: 'ts-loader', query: { 'ignoreDiagnostics': [ 2403, // 2403 -> Subsequent variable declarations 2300, // 2300 Duplicate identifier 2304, // 2304 Cannot find name 2374, // 2374 -> Duplicate number index signature 2375 // 2375 -> Duplicate string index signature ] }, exclude: [ /.spec.ts$/, /.e2e.ts$/, /node_modules/ ] },

  // Support for *.json files.
  { test: /\.json$/,  loader: 'json-loader' },

  // Support for CSS as raw text
  { test: /\.css$/,   loader: 'raw-loader' },

  // support for .html as raw text
  { test: /\.html$/,  loader: 'raw-loader' },
  { test: /\.css/, loader: 'style!css' },
  { test: /\.woff|\.woff2|\.svg|.eot|\.ttf/, loader: 'file' }
],
noParse: [
 /zone\.js\/dist\/.+/,
 /reflect-metadata/,
 /es(6|7)-.+/,
 /.zone-microtask/, 
 /.long-stack-trace-zone/
]

},

plugins: [ new CommonsChunkPlugin({ name: 'vendor', filename: 'vendor.js', minChunks: Infinity }), new CommonsChunkPlugin({ name: 'common', filename: 'common.js', minChunks: 2, chunks: ['app', 'vendor'] }) ],

// Other module loader config tslint: { emitErrors: false, failOnHint: false },

// our Development Server configs // our Webpack Development Server config devServer: { historyApiFallback: true, publicPath: '/build' } };

function getBanner() { return 'This is a sample that shows how to add authentication to an Angular 2 (ng2) app by @auth0'; }

function root(args) { args = sliceArgs(arguments, 0); return path.join.apply(path, [__dirname].concat(args)); } function rootNode(args) { args = sliceArgs(arguments, 0); return root.apply(path, ['node_modules'].concat(args)); }

and this is my index.ts when i get the error in the import `import { bootstrap } from '@angular/platform-browser-dynamic'; import { provideRouter } from '@angular/router'; import { FORM_PROVIDERS } from '@angular/common'; import { HTTP_PROVIDERS } from '@angular/http'; import { AUTH_PROVIDERS } from 'angular2-jwt'; import { AuthGuard } from './common/auth.guard'; import { EmpleadoService } from './common/empleado.service';

import { provide, PLATFORM_DIRECTIVES } from '@angular/core'; import { FontAwesomeDirective } from 'ng2-fontawesome';

import { App } from './app'; import { routes } from './app.routes';

bootstrap( App, [ provideRouter(routes), provide(PLATFORM_DIRECTIVES, { useValue: FontAwesomeDirective, multi: true }), FORM_PROVIDERS, HTTP_PROVIDERS, AUTH_PROVIDERS, AuthGuard, EmpleadoService ] );`

seiyria commented 8 years ago

I'm not reading all of that, especially unformatted. I also don't know how to use it with tsc, if that's what you're doing.

seustachi commented 8 years ago

I guess that the seed project expects a .d.ts to load the module.

ghost commented 7 years ago

i am also getting the error with "cannot find ng2-fontawesome" module .I followed all the steps given in readme file.

seiyria commented 7 years ago

This project may or may not be compatible with typescript, and is definitely not compatible with any rc or release above what it states in the package.json (rc4). Please submit a PR if you want this to be usable in the release.

NLebedev commented 7 years ago

Same here, apparently doesn't work with typescript

seiyria commented 7 years ago

I'd be happy to have a PR that fixes this.