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.
I got this same Cannot read property 'newLine' of undefined thing with fresh project and latest angular-cli (rc0). noticed it uses yarn during ng new. So i tried rm -rf node_modules && npm cache clean && npm install and that worked.
Perhaps yarn is locked to some broken setup which is resolved by npm's dependency management?
Can you paste your package.json dependencies, guys?
In my case the root cause was using -lc argument. package.json in both cases is same, but if i do
ng new foo then ng can be served, but when i do
ng new -lc foo then ng can be served, but when it fails and only way to fix it is to remove node_modules and install again with npm i or yarn
a bit about me (if it may help): yarn: 0.21.3 node: 7.7.1 angular-cli: 1.0.0-rc.0
in index.html may help
Hi,
Found the solution. If you the error above still persist then try this:
open angular-cli.json find- "environments": { "source": "environments/environment.ts", "dev": "environments/environment.ts", "prod": "environments/environment.prod.ts" }
and replace with: "environmentSource": "environments/environment.ts", "environments": { "dev": "environments/environment.ts", "prod": "environments/environment.prod.ts" }
Not sure if this helps anyone else with this issue or not. I was experiencing it and turned here looking for ideas. As I was scrolling through, I double-checked my package.json and discovered that I had the beta and rc versions of the cli installed. I removed the pointer to the beta version (angular-cli), deleted my node_modules and reran npm install. Fixed my issue.
Yeah, but i have uninstall angularCLI package and deleted node_module files then i reinstalled the angularCLI thereafter i just modified angular-cli.json as shown above then it worked.
On a Windows 7, 64bit
rm -rf node_modules
npm install
ng serve
solved it. :rocket:
The steps to solve this:
- Upgrade your npm version (to 3 or +) (this was the little devil)
- Uninstall angular-cli,
- Clean npm cache (npm clean cache)
- Install Angular-cli again
Some dependencies can´t be installed with older npm versions, and you only get a warning ;) but angular-cli installs anyway.... without the dependencies
This really looks like upgrade problems. We have an upgrade story you can follow to ensure upgrading is done right: https://github.com/angular/angular-cli/wiki/stories-rc-update
i have tried all the above solutions still the problem persisits...please help...
Microsoft Windows [Version 10.0.14393] (c) 2016 Microsoft Corporation. All rights reserved.
C:\Users\Manirish>npm install npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN @angular/[email protected] requires a peer of rxjs@^5.0.1 but none was installed. npm WARN @angular/[email protected] requires a peer of rxjs@^5.0.1 but none was installed. npm WARN @angular/[email protected] requires a peer of rxjs@^5.0.1 but none was installed. npm WARN [email protected] requires a peer of tslint@^4.0.0 but none was installed.
C:\Users\Manirish>npm start
[email protected] start C:\Users\Manirish ng serve
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" }
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "start"
npm ERR! node v7.8.0
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: ng serve
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'ng serve'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the untitled1 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ng serve
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs untitled1
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls untitled1
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request: npm ERR! C:\Users\Manirish\AppData\Roaming\npm-cache_logs\2017-04-02T00_45_05_847Z-debug.log
C:\Users\Manirish>
@mairis79 Your error tells you exactly what to do. What happened is you have an older version of the CLI used to set up your project, and you have to update the angular-cli.json file as it describes.
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" }
I am having the same problem. I Downgraded my Node via nvm from the current stable version, I removed the node_modules and cleared the cache. I also removed the global @angular/cli and installed it again.
My angular-cli.json already has the 'After:' text: "environmentSource": "environments/environment.ts", "environments": { "dev": "environments/environment.ts", "prod": "environments/environment.prod.ts" }
bash-3.2$ nvm ls -> v6.9.5 v7.8.0 system
NB - I am not looking for help with getting this working (I can make ng new project and copy code there) - It's more that the error displayed isn't accurate.
default -> v6.9.5
node -> stable (-> v7.8.0) (default)
stable -> 7.8 (-> v7.8.0) (default)
iojs -> N/A (default)
bash-3.2$ ng -v
_ _ ____ _ ___
/ \ _ __ __ _ _ | | __ _ _ __ / | | | |
/ △ \ | ' \ / _ | | | | |/ _ | '| | | | | | |
/ ___ | | | | (| | || | | (| | | | || | | |
// __| ||_, |_,||_,|| _|||
|___/
@angular/cli: 1.0.0
node: 6.9.5
os: darwin x64
@angular/common: 4.0.1
@angular/compiler: 4.0.1
@angular/compiler-cli: 4.0.1
@angular/core: 4.0.1
@angular/forms: 4.0.1
@angular/http: 4.0.1
@angular/platform-browser: 4.0.1
@angular/platform-browser-dynamic: 4.0.1
@angular/platform-server: 4.0.1
@angular/router: 4.0.1
@angular/tsc-wrapped: 4.0.1
@angular/upgrade: 4.0.1
@angular/animations: 4.0.1
@angular/cli: 1.0.0
@paulmc it might make sense to open a new issue for that :)
Keep together work for me
"environmentSource": "environments/environment.ts",
"environments": {
"source": "environments/environment.ts",
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
@dherges It works for me. But why can it solve this ?
@neosoko Worked perfectly. Thanks mate.
@neosoko Thanks mate ur solution worked for me :+1:
I had the same issue, changing the configuration in angular-cli.json solved it, as it said :
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"
}
I don't think that's the problem my problem seems that the node server which is server.js is not responding to an event from angular, on angular I have a post-event that is being a triggered, OK, it works, the problem is that when in production on a Heroku environment the node server isn't aware, the app runs when opened, but it tries to connect to my local server.js. Better said if I run node server.js on my local it works. If node server.js on my local isn't running. I get options http://llocalhost:8080coins/add 0 (), and ERROR Unknow Error, can anyone help...