jelgblad / angular2-masonry

https://github.com/desandro/masonry module for Angular2
101 stars 48 forks source link

Cannot build with Webpack #41

Closed mateuswetah closed 7 years ago

mateuswetah commented 7 years ago

Hi guys!

Thanks for all the work, it really attends to a big requirement on the project that I'm working right now! The problem is, it's doing fine on my localhost tests, but once I move it to server and try a ng build, I get this error:

ERROR in Error encountered resolving symbol values statically. Could not resolve angular2-masonry relative to /home/mateus_luna/Projeto-Salic/src/app/app.module.ts., resolving symbol AppModule in /home/mateus_luna/Projeto-Salic/src/app/app.module.ts, resolving symbol AppModule in /home/mateus_luna/Projeto-Salic/src/app/app.module.ts

ERROR in /home/mateus_luna/Projeto-Salic/src/app/app.module.ts (9,31): Cannot find module 'angular2-masonry'.)

ERROR in ./src/app/app.module.ts
Module not found: Error: Can't resolve 'angular2-masonry' in '/home/mateus_luna/Projeto-Salic/src/app'
 @ ./src/app/app.module.ts 18:0-49
 @ ./src/main.ts
 @ multi ./src/main.ts

i installed it via npm install angular2-masonry --save, which works, now I have "angular2-materialize": "^6.7.1" in my dependencies.

And loaded in my app.module just as described in the docs:

import { MasonryModule } from 'angular2-masonry';

...

  imports: [
    BrowserModule,
    FormsModule,
    HttpModule,
    AppRoutingModule,
    ShareButtonsModule.forRoot(),
    AlertModule.forRoot(),
    DropdownModule.forRoot(),
    ButtonsModule.forRoot(),
    CollapseModule.forRoot(),
    PaginationModule.forRoot(),
    MasonryModule
]

is there anything else that I'm missing? I did everything from the Readme, except for the System.js part, as I'm using Webpack.

My versions:

@angular/cli: 1.0.0-beta.31
node: 7.4.0
os: linux x64
@angular/cli: 1.0.0-beta.31
@angular/common: 2.4.10
@angular/compiler: 2.4.10
@angular/compiler-cli: 2.4.10
@angular/core: 2.4.10
@angular/flex-layout: 2.0.0-rc.1
@angular/forms: 2.4.10
@angular/http: 2.4.10
@angular/platform-browser: 2.4.10
@angular/platform-browser-dynamic: 2.4.10
@angular/router: 3.4.10

I'm sorry if it's a dumb question, I'm pretty new on Angular2 :P

cpoll commented 7 years ago

Double-check that you're running npm install before building, and that the node_modules folder actually contains angular2-masonry.

If node_modules is missing the folder, and npm install isn't behaving how you're expecting it to, it might be the package-lock.json file that's to blame.

mateuswetah commented 7 years ago

Hi there. Wow, this was a long time ago xD Although I ended up moving to another library due to a design decision, I should have posted here that I find out what was the problem. I was moving my code to server without updating node_modules folder, so obviously a npm install was needed... pretty dumb of me :P

Anyways, thank you :)