x)
I guess it affects "all" because I couldn't even install the cli.
- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
It isntalls with 7.x version
Yes, the previous version in which this bug was not present was: ....
Using the angular cli installation command: sudo npm install -g @angular/cli
I get this error: https://pastebin.com/aqDXNBM0
There's no such file '/home/user/.angular-config.json', I have tried creating it by the 'touch' command, but it gave another error: https://pastebin.com/xZNQUwAa
I have tried 'npm cache clean --force' command with the same results.
I tried to install a previous verison of Angular with the 'sudo npm install -g @angular/[email protected]' and it installed it however it throws "Workspace needs to be loaded before it is used.", I guess it's because of the angular-config.json I've created...
A clear and concise description of the problem...
sudo npm i -g @angular/cli
I have linked the errors above.
Couldn't run ng version with angular 8.x
ng version with 7.x
Angular CLI: 7.3.9
Node: 12.4.0
OS: linux x64
Angular:
...
Package Version
------------------------------------------------------
@angular-devkit/architect 0.13.9
@angular-devkit/core 7.3.9
@angular-devkit/schematics 7.3.9
@schematics/angular 7.3.9
@schematics/update 0.13.9
rxjs 6.3.3
typescript 3.2.4
Anything else relevant?
The relevant part of the log is:
(node:5022) UnhandledPromiseRejectionWarning: Error: EACCES: permission denied, open '/home/user/.angular-config.json'
at Object.openSync (fs.js:447:3)
at Object.writeFileSync (fs.js:1206:35)
at createGlobalSettings (/usr/lib/node_modules/@angular/cli/utilities/config.js:65:10)
at Object.getWorkspaceRaw (/usr/lib/node_modules/@angular/cli/utilities/config.js:73:26)
at setAnalyticsConfig (/usr/lib/node_modules/@angular/cli/models/analytics.js:288:43)
at Object.promptGlobalAnalytics (/usr/lib/node_modules/@angular/cli/models/analytics.js:326:9)
at processTicksAndRejections (internal/process/task_queues.js:89:5)
(node:5022) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:5022) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
+ @angular/[email protected]
It seems that you don't have write permissions on that path.
Thanks for the response!
But how come I could install a previous version of the cli?
Because this logic is part of version 8.
That said, we should probably handle it more gracefully and not bail out when the CLI doesn't have permission to write a global config.
//cc @clydin, thoughts?
It's worth mentioning that you should not install global npm modules with sudo. Please have a look at the fixing npm permissions page.
Thank you @filipesilva, I think I will check out npx.
Instead of failing can we throw a warning and fallback to default config (analytics off).
Alternatively, brew handles this really well by giving you a hint about what command you should run to fix your permissions.
(node:18440) UnhandledPromiseRejectionWarning: Error: EACCES: permission denied, open '/home/ashu/.angular-config.json'
at Object.openSync (fs.js:436:3)
at Object.writeFileSync (fs.js:1187:35)
at createGlobalSettings (/usr/lib/node_modules/@angular/cli/utilities/config.js:65:10)
at Object.getWorkspaceRaw (/usr/lib/node_modules/@angular/cli/utilities/config.js:73:26)
at setAnalyticsConfig (/usr/lib/node_modules/@angular/cli/models/analytics.js:288:43)
at Object.promptGlobalAnalytics (/usr/lib/node_modules/@angular/cli/models/analytics.js:326:9)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:18440) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:18440) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Not being able to write to your own home directory typically signifies a system-wide configuration issue.
Note, however, that the next patch release of the Angular CLI will not crash in this situation.
Not being able to write to your own home directory typically signifies a system-wide configuration issue.
Note, however, that the next patch release of the Angular CLI will not crash in this situation.
then any alternate way to fix this issue as of now
I am also facing the same issue. Any way to fix this?
Well, I kinda hate npm tbh. However, I was installing my tools via it for a long time. That has changed.
My solution is to use yarn:
sudo npm uninstall -g @angular/cli
sudo yarn global add @angular/cli
Works like a charm.
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
It's worth mentioning that you should not install global npm modules with
sudo. Please have a look at the fixing npm permissions page.