Please provide us with the following information:
- OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
OS X El Capitan
ng --version. If there's nothing outputted, please runnode --version and paste the result here:I cloned the master branch and ran npm link in the cloned directory.
After running npm link, I created a new project with ng new ng2-demo. When I tried to run ng serve, I received the following error.
$ ng serve
10% building modules 1/1 modules 0 active
*
*
NG Live Development Server is running on http://localhost:4200.
*
1133ms building modules
2ms sealing
1ms optimizing
0ms basic module optimization
2ms module optimization
1ms advanced module optimization
3ms basic chunk optimization
0ms chunk optimization
0ms advanced chunk optimization
0ms module and chunk tree optimization
5ms module reviving
1ms module order optimization
1ms module id optimization
1ms chunk reviving
0ms chunk order optimization
3ms chunk id optimization
4ms hashing
0ms module assets processing
20ms chunk assets processing
1ms additional chunk assets processing
0ms recording
0ms additional asset processing
14ms chunk asset optimization
25ms asset optimization
11ms emitting
Hash: 96254c1f9bc487557b2b
Version: webpack 2.1.0-beta.18
Time: 1245ms
Asset Size Chunks Chunk Names
main.bundle.js 240 kB 0, 1 [emitted] main
inline.js 4.96 kB 1 [emitted] inline
main.map 293 kB 0, 1 [emitted] main
inline.map 5.13 kB 1 [emitted] inline
index.html 2.55 kB [emitted]
ERROR in multi main
Module not found: Error: Can't resolve '/Users/mraible/ng2-demo/undefined/main.ts' in '/Users/mraible/ng2-demo/node_modules/angular-cli/addon/ng2/models'
@ multi main
ERROR in Entry module not found: Error: Can't resolve '/Users/mraible/ng2-demo/undefined/polyfills.ts' in '/Users/mraible/ng2-demo/node_modules/angular-cli/addon/ng2/models'
ERROR in Error: Child compilation failed:
Entry module not found: Error: Can't resolve '/Users/mraible/ng2-demo/undefined/index.html' in '/Users/mraible/ng2-dem o/node_modules/angular-cli/addon/ng2/models':
Error: Can't resolve '/Users/mraible/ng2-demo/undefined/index.html' in '/Users/mraible/ng2-demo/node_modules/angular-c li/addon/ng2/models'
- compiler.js:76
[ng2-demo]/[html-webpack-plugin]/lib/compiler.js:76:16
- Compiler.js:251 Compiler.<anonymous>
[ng2-demo]/[webpack]/lib/Compiler.js:251:10
- Compiler.js:442
[ng2-demo]/[webpack]/lib/Compiler.js:442:12
- Tapable.js:81 next
[ng2-demo]/[tapable]/lib/Tapable.js:81:11
- CachePlugin.js:61 Compiler.<anonymous>
[ng2-demo]/[webpack]/lib/CachePlugin.js:61:4
- Tapable.js:85 Compiler.applyPluginsAsync
[ng2-demo]/[tapable]/lib/Tapable.js:85:13
- Compiler.js:439 Compiler.<anonymous>
[ng2-demo]/[webpack]/lib/Compiler.js:439:9
- Tapable.js:73 Compilation.applyPluginsAsync
[ng2-demo]/[tapable]/lib/Tapable.js:73:70
- Compilation.js:617 Compilation.<anonymous>
[ng2-demo]/[webpack]/lib/Compilation.js:617:18
- Tapable.js:73 Compilation.applyPluginsAsync
[ng2-demo]/[tapable]/lib/Tapable.js:73:70
- Compilation.js:608 Compilation.<anonymous>
[ng2-demo]/[webpack]/lib/Compilation.js:608:10
- Tapable.js:73 Compilation.applyPluginsAsync
[ng2-demo]/[tapable]/lib/Tapable.js:73:70
- Compilation.js:603 Compilation.<anonymous>
[ng2-demo]/[webpack]/lib/Compilation.js:603:9
- Tapable.js:73 Compilation.applyPluginsAsync
[ng2-demo]/[tapable]/lib/Tapable.js:73:70
- Compilation.js:599 Compilation.<anonymous>
[ng2-demo]/[webpack]/lib/Compilation.js:599:8
- Tapable.js:73 Compilation.applyPluginsAsync
[ng2-demo]/[tapable]/lib/Tapable.js:73:70
- Compilation.js:547 Compilation.seal
[ng2-demo]/[webpack]/lib/Compilation.js:547:7
- Compiler.js:436 Compiler.<anonymous>
[ng2-demo]/[webpack]/lib/Compiler.js:436:15
- Tapable.js:152
[ng2-demo]/[tapable]/lib/Tapable.js:152:11
- Compilation.js:434 Compilation.<anonymous>
[ng2-demo]/[webpack]/lib/Compilation.js:434:10
- Compilation.js:337 Compilation.errorAndCallback
[ng2-demo]/[webpack]/lib/Compilation.js:337:3
- Compilation.js:351 Compilation.<anonymous>
[ng2-demo]/[webpack]/lib/Compilation.js:351:11
Child html-webpack-plugin for "index.html":
ERROR in Entry module not found: Error: Can't resolve '/Users/mraible/ng2-demo/undefined/index.html' in '/Users/mraible/ng2-demo/node_modules/angular-cli/addon/ng2/models'
webpack: bundle is now VALID.
If I checkout a prior revision, it works.
git checkout 454286f96e5bc1a9b512a8f00da45baea7c9428a
https://github.com/angular/angular-cli/commit/454286f96e5bc1a9b512a8f00da45baea7c9428a
$ ng serve
10% building modules 1/1 modules 0 active
*
*
NG Live Development Server is running on http://localhost:4200.
*
5923ms building modules
9ms sealing
1ms optimizing
0ms basic module optimization
14ms module optimization
0ms advanced module optimization
7ms basic chunk optimization
0ms chunk optimization
0ms advanced chunk optimization
0ms module and chunk tree optimization
62ms module reviving
5ms module order optimization
3ms module id optimization
3ms chunk reviving
1ms chunk order optimization
25ms chunk id optimization
21ms hashing
1ms module assets processing
79ms chunk assets processing
2ms additional chunk assets processing
0ms recording
0ms additional asset processing
130ms chunk asset optimization
1656ms asset optimization
40ms emitting
Hash: 3863e88ee7eabcf29434
Version: webpack 2.1.0-beta.18
Time: 8001ms
Asset Size Chunks Chunk Names
main.bundle.js 2.54 MB 0, 2 [emitted] main
polyfills.bundle.js 228 kB 1, 2 [emitted] polyfills
inline.js 4.96 kB 2 [emitted] inline
main.map 3 MB 0, 2 [emitted] main
polyfills.map 288 kB 1, 2 [emitted] polyfills
inline.map 5.13 kB 2 [emitted] inline
index.html 480 bytes [emitted]
Child html-webpack-plugin for "index.html":
Asset Size Chunks Chunk Names
index.html 2.4 kB 0
webpack: bundle is now VALID.
Node version 4.4.7 and npm version 3.10.6.
Just add "sourceDir":"src" to "defaults" in angular-cli.json 😄
"defaults": {
"styleExt": "css",
"prefixInterfaces": false,
"lazyRoutePrefix": "+",
"sourceDir":"src"
}
or change in package.json
"angular-cli": "https://github.com/angular/angular-cli",
@Boffka That does solve the problem, so it seems there's a bug on master that this is missing?
I also get some log messages mixed in when running ng new on one of my machines (doesn't happen on the other one).
Successfully initialized git.
⠹ Installing packages for tooling via npmBinary downloaded and installed at /Users/mraible/html5-denver/node_modules/node-sass/vendor/darwin-x64-46/binding.node
⠦ Installing packages for tooling via npmPhantomJS not found on PATH
Download already available at /var/folders/fc/_yl631td525bt3bqrd3fg7f40000gp/T/phantomjs/phantomjs-2.1.1-macosx.zip
⠧ Installing packages for tooling via npmVerified checksum of previously downloaded file
Extracting zip contents
⠸ Installing packages for tooling via npmRemoving /Users/mraible/html5-denver/node_modules/phantomjs-prebuilt/lib/phantom
Copying extracted folder /var/folders/fc/_yl631td525bt3bqrd3fg7f40000gp/T/phantomjs/phantomjs-2.1.1-macosx.zip-extract-1471715731000/phantomjs-2.1.1-macosx -> /Users/mraible/html5-denver/node_modules/phantomjs-prebuilt/lib/phantom
⠼ Installing packages for tooling via npmWriting location.js file
Done. Phantomjs binary available at /Users/mraible/html5-denver/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs
⠏ Installing packages for tooling via npm"/Users/mraible/html5-denver/node_modules/node-sass/vendor/darwin-x64-46/binding.node" exists.
testing binary.
⠋ Installing packages for tooling via npmBinary is fine; exiting.
Installed packages for tooling via npm.
When you created a project via ng new ng2-demo, you didn't link the CLI _inside_ that project so you were still using the non-master version. Do ng new foo --link-cli instead.
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
Just add
"sourceDir":"src"to "defaults" in angular-cli.json 😄or change in package.json