jelbourn / material2-app

Simple app that consumes Angular Material 2 components
650 stars 278 forks source link

[error] ng serve #28

Closed jlno closed 7 years ago

jlno commented 7 years ago

After run ng serve:

Tried to find bootstrap code, but could not. Specify either statically analyzable bootstrap code or pass in an entryModule to the plugins options. Error: Tried to find bootstrap code, but could not. Specify either statically analyzable bootstrap code or pass in an entryModule to the plugins options.

rlasjunies commented 7 years ago

@jlno, I jump in the same trap.

This is due to the modification in main.ts file to support the aot.

try what's recommended: /**

or comment aot code, uncomment JIT code in src/main.ts and it's work. This is what I did for now.

Hope that help

3kavinraj commented 7 years ago

Commenting AoT and uncommenting JIT, caused me this

E:\SANDBOX\ANGULAR2\material2-app>ng serve
patterns.map is not a function
TypeError: patterns.map is not a function
    at GlobCopyWebpackPlugin.apply (E:\SANDBOX\ANGULAR2\material2-app\node_modules\angular-cli\plugins\glob-copy-webpack-plugin.js:16:29)
    at Compiler.apply (E:\SANDBOX\ANGULAR2\material2-app\node_modules\tapable\lib\Tapable.js:270:16)
    at WebpackOptionsApply.process (E:\SANDBOX\ANGULAR2\material2-app\node_modules\webpack\lib\WebpackOptionsApply.js:59:18)
    at webpack (E:\SANDBOX\ANGULAR2\material2-app\node_modules\webpack\lib\webpack.js:28:48)
    at Class.run (E:\SANDBOX\ANGULAR2\material2-app\node_modules\angular-cli\tasks\serve-webpack.js:38:27)
    at E:\SANDBOX\ANGULAR2\material2-app\node_modules\angular-cli\commands\serve.js:108:26
    at process._tickCallback (internal/process/next_tick.js:103:7)

"First run ./node_modules/.bin/ngc -p ./src/" means what? When to run? Where to run?!

Please help!

jlno commented 7 years ago

@kavingit this project is out of date, create a new project and import the material2.

fidergo-stephane-gourichon commented 7 years ago

Hello. Just his same issue.

Steps to reproduce

git clone https://github.com/jelbourn/material2-app/
npm install
npm start

Expected result

Angular app served via HTTP.

Observed result

Error message:

Tried to find bootstrap code, but could not. Specify either statically analyzable bootstrap code or pass in an entryModule to the plugins options.
Error: Tried to find bootstrap code, but could not. Specify either statically analyzable bootstrap code or pass in an entryModule to the plugins options.
    at Object.resolveEntryModuleFromMain (.../material2-app/node_modules/@ngtools/webpack/src/entry_resolver.js:131:11)
    at AotPlugin._setupOptions (.../material2-app/node_modules/@ngtools/webpack/src/plugin.js:158:54)
    at new AotPlugin (.../material2-app/node_modules/@ngtools/webpack/src/plugin.js:17:14)
    at Object.exports.getWebpackNonAotConfigPartial (.../material2-app/node_modules/angular-cli/models/webpack-build-typescript.js:20:13)
    at new NgCliWebpackConfig (.../material2-app/node_modules/angular-cli/models/webpack-config.js:26:42)
    at Class.run (.../material2-app/node_modules/angular-cli/tasks/serve-webpack.js:20:22)
    at .../material2-app/node_modules/angular-cli/commands/serve.js:108:26
    at process._tickCallback (internal/process/next_tick.js:103:7)

Additional information

./node_modules/.bin/ngc -p ./src/

Error at .../material2-app/src/main.ts:25:42: Cannot find module './aot/app/app.module.ngfactory'.

Additional information

Ubuntu 16.04 AMD64

node --version

v6.9.2
fidergo-stephane-gourichon commented 7 years ago

This is due to the modification in main.ts file to support the aot.

This practically translates to:

git checkout -- src/main.ts # revert to original repo state, don't do if you've got some local changes
git diff a16097b20774d2bd18024f77470a78f53d1fd02d..59005f6558a0a67761a8f192a84c434ef005f9f9 src/main.ts | patch -p1 -R

Seems to let things go further, still not working though, I get into same problem as @kavingit .

@kavingit this project is out of date, create a new project and import the material2.

What do you mean "this project is out of date"? Can you be more explicit? Thanks.

edemirkan commented 7 years ago

@fidergo-stephane-gourichon If you (or anyone else) still have trouble running the sample app, I created an up-to-date version of the project. Please check https://github.com/demirk4n/material2-demo