ng serve not working when install latest version of angular cli
Please provide us with the following information: windows 10
angular/cli: 1.0.0-beta.32.3 [1.0.0-beta.26] node: 6.9.5 os: win32 x64 @angular/cli: 1.0.0-beta.32.3
nothing just upgraded to the new version and started having all these problems also I get this error also can't find @angular/platform-browser-dynamic
OS?
Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
Versions.
Please run
ng --version. If there's nothing outputted, please run in a Terminal:node --versionand paste the result here:
Repro steps.
Was this an app that wasn't created using the CLI? What change did you do on your code? etc.
The log given by the failure.
Normally this include a stack trace and some more information.
Mention any other details that might be useful.
Thanks! We'll be in touch soon.
@tedrob can you please enter the information requested in the template? It looks like you posted just the template without entering the details. Thanks!
@tedrob can you try to remove node_modules from you project and run npm install again?
I removed node-modules and still get the error can't find from '@angular/platform-browser-dynamic';
also when I run ng serve I can't find Tried to find bootstrap code, but could not
I upgraded from a project using CLI beta.26 to 32.3, following directions here to upgrade the cli. At first running NG Serve produced a request to modify the cli json file: "To migrate angular-cli.json follow the example below:" as per the Breaking changes note. Which I did. Then ran ng serve again. That seemed to start the server, but with an error: "ERROR in AppModule is not an NgModule" And browsing to the localhost:4200 gives me: "Cannot GET /" I then manually renamed angular-cli.json to begin with . as mentioned per 'code refactoring' same problem ng version output: @angular/cli: 1.0.0-beta.32.3 node: 6.9.5 os: win32 x64 Windows 10
Created new project with ng new and then ran ng serve. Works!
just sayin'
What is the output of this:
npm ls @angular/platform-browser-dynamic
-- @angular/[email protected]
now I get this error ERROR in ./src/main.ts Module build failed: TypeError: Cannot read property 'newLine' of undefined at Object.getNewLineCharacter (C:\aaa-angular2\foundation\ag2-tubes\node_modules\typescript\lib\typescript.js:8062:20) at Object.createCompilerHost (C:\aaa-angular2\foundation\ag2-tubes\node_modules\typescript\lib\typescript.js:44978:26) at Object.ngcLoader (C:\aaa-angular2\foundation\ag2-tubes\node_modules@ngtools\webpack\src\loader.js:350:33) @ multi webpack-dev-server/client?http://localhost:4200/ ./src/main.ts
I tried that and still get the same problem, but when you say you renamed angular-cli.json to begin with a . do you mean .angular-cli.json
or angular.cli.json
Which is it?
OK I renamed angular-cli.json to .angular-cli.json but still get this error ERROR in ./src/main.ts Module build failed: TypeError: Cannot read property 'newLine' of undefined at Object.getNewLineCharacter (C:\aaa-angular2\foundation\ag2-tubes\node_modules\typescript\lib\typescript.js:8062:20) at Object.createCompilerHost (C:\aaa-angular2\foundation\ag2-tubes\node_modules\typescript\lib\typescript.js:44978:26) at Object.ngcLoader (C:\aaa-angular2\foundation\ag2-tubes\node_modules@ngtools\webpack\src\loader.js:350:33) @ multi webpack-dev-server/client?http://localhost:4200/ ./src/main.ts
@tedrob - sorry my comment came in as exact same time as @beeman. I did not have a solution or good troubleshooting. Just figured that in my case (.26 -> 32.3), the new version has so many breaking changes that I may as well give up on the old project and have ngCLI build a new one, then transfer module code etc into that new project. I apologize for confusing this thread.
I guess we cannot expect upgrade stability until we get to RC stage at least.
I have some weird issues with
@angular/cli: 1.0.0-beta.32.3
node: 7.3.0
os: win32 ia32
npm 3.10.10
A new project created with ng new project-name runs fine in Firefox 52.0b7, but doesn't run in IE 11.0.9600.18537 and Chrome 43.0.2357.134 m which both show an error message "Unable to get property 'apply' of undefined or null reference" for this function
function combine(options) {
return (_a = ((Object))).assign.apply(_a, [{}].concat(options));
var _a;
}
IE says it's in vendor.bundle.js, Chrome says it's in intl.js.
Same Problem need help
Environment configuration does not contain "environmentSource" entry.
A new environmentSource entry replaces the previous source entry inside environments.
To migrate angular-cli.json follow the example below:
Before:
"environments": {
"source": "environments/environment.ts",
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
After:
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
ng serve is not serving old angular2 projects.
@rahulroxx the suggested fix is printed there.
I did the same but throws new error as posted by @tedrob
Module build failed: TypeError: Cannot read property 'newLine' of undefined
at Object.getNewLineCharacter (C:\aaa-angular2\foundation\ag2-tubes\node_modules\typescript\lib\typescript.js:8062:20)
at Object.createCompilerHost (C:\aaa-angular2\foundation\ag2-tubes\node_modules\typescript\lib\typescript.js:44978:26)
at Object.ngcLoader (C:\aaa-angular2\foundation\ag2-tubes\node_modules@ngtools\webpack\src\loader.js:350:33)
@ multi webpack-dev-server/client?http://localhost:4200/ ./src/main.ts
Try these steps please:
Clean up
- remove node_modules from your project
- remove any
angular-cliand@angular/clireferences from package.json if it's there - Uninstall
angular-cliand@angular/cliglobally:npm uninstall -g angular-cli @angular/cli
Reinstall
- Install
@angular/cliglobally:npm install -g @angular/cli - Install
@angular/cliin your project:npm install --save-dev @angular/cli
If @beeman's steps don't work, check which version of node you're using.
Steps:
node -vshould be v6.9.0 or higher. If not, keep reading.- Run
nvm ls. The output should look something like this:
$ nvm ls
v5.0.0
-> v5.9.0
v6.9.5
system
default -> node (-> v6.9.5)
node -> stable (-> v6.9.5) (default)
stable -> 6.9 (-> v6.9.5) (default)
iojs -> N/A (default)
- If v6.9 isn't installed, run
nvm install v6.9 - Run
node -vand check if it's now using v6.9._. If not, runnvm use 6.9
I'm facing this same problem after upgrading from beta24, and followed each breaking change step in the changelog.
I uninstalled everything as @beeman suggested, and see the newLine error.
@angular/cli: 1.0.0-rc.0
node: 6.9.2
os: darwin x64
@angular/common: 2.4.7
@angular/compiler: 2.4.7
@angular/compiler-cli: 2.4.7
@angular/core: 2.4.7
@angular/forms: 2.4.7
@angular/http: 2.4.7
@angular/platform-browser: 2.4.7
@angular/platform-browser-dynamic: 2.4.7
@angular/router: 3.4.7
@angular/cli: 1.0.0-rc.0
Error
ERROR in ./src/main.ts
Module build failed: TypeError: Cannot read property 'newLine' of undefined
at Object.getNewLineCharacter (/.../node_modules/typescript/lib/typescript.js:9426:20)
at Object.createCompilerHost (/.../node_modules/typescript/lib/typescript.js:62475:26)
at Object.ngcLoader (/.../node_modules/@ngtools/webpack/src/loader.js:341:33)
@ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts
webpack: Failed to compile.
@khizerrehands You need to follow the environments portion of the angular-cli.json file just like it mentions in the error. Replace the environments property with these two.
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}