Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[error] ng serve #28

Closed
jlno opened this issue Dec 22, 2016 · 6 comments
Closed

[error] ng serve #28

jlno opened this issue Dec 22, 2016 · 6 comments

Comments

@jlno
Copy link

jlno commented Dec 22, 2016

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
Copy link

@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:
/**

  • AoT compile.
  • First run ./node_modules/.bin/ngc -p ./src/
    */

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
Copy link

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
Copy link
Author

jlno commented Dec 29, 2016

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

@fidergo-stephane-gourichon
Copy link

fidergo-stephane-gourichon commented Dec 29, 2016

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

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
Copy link

@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

@jlno jlno closed this as completed Mar 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants