DEV Community

Gluups
Gluups

Posted on

No Angular any more !

Hello everybody,
I got no answer to this thread hereunder since soon two weeks, so I am trying to find help where I can, so I presume that people who develop with Angular can be a good target -oh, perhaps npm also.
Suddenly Angular could not be installed any more on a new project, I got a message telling about an intrinsic error of npm.
I tried installing some modules that seemed to miss, the return gave to think that I succeeded in that, but ... Angular still does not answer.
Any idea what to do ?

The URL given in the error message rerouted to github :
https://github.community/t/failure-to-install-angular/201932

When I say that ng does not answer, it is not that it crashes, no it has finished work.


D:\Projects Visual Studio\Web\WeatherProject024\WeatherProject024\WeatherClient
22:29:47>ng serve --o

D:\Projects Visual Studio\Web\WeatherProject024\WeatherProject024\WeatherClient
22:29:50>


I cannot give colors for the prompt, can I ?
Oh, I forgot to inform about my System :
Microsoft Windows [version 10.0.19043.1237] => version 21H1
If a script is needed, perhaps Powershell can help ?

And also :

npm version
{
npm: '6.14.11',
ares: '1.16.1',
brotli: '1.0.9',
cldr: '37.0',
icu: '67.1',
llhttp: '2.1.3',
modules: '83',
napi: '7',
nghttp2: '1.41.0',
node: '14.16.0',
openssl: '1.1.1j',
tz: '2020a',
unicode: '13.0',
uv: '1.40.0',
v8: '8.4.371.19-node.18',
zlib: '1.2.11'
}

and ... you know what ? "ng version" answers the same as
"ng serve --o".


Perhaps it will be easier to read if I repeat the URL at the end of my message :
https://github.community/t/failure-to-install-angular/201932

Top comments (12)

Collapse
 
gluups profile image
Gluups • Edited

Hello everybody,

Oh well, I had to swift to something else during 10 days, so I did not touch to Angular nor npm, at least so far as I know, and when I am back l see that my project misses a lot of dependencies again. So I have to go through a loop with


npm ls
npm ls | FIND "UNMET"
npm install ansi-styles@2.2.1

and so on (there would be an interesting work to do to automatize a part of that with Powershell).

Now, I am failing to install node-sass, there is a 404 error on the repository (of win32-x64-83_binding.node), and a syntax error in the call of Python, as it seems they target version 2, which is not available any more. Same thing with their mirror in China.

Anything that I misinterpreted ?

This page
npmjs.com/package/node-sass
was updated 4 months ago, not an eternity ?

Something is strange about win32-x64-83_binding.node : I see forums threads about this in February, and I did not have the problem 10 days ago.

I tried
npm install node-sass@4.14.1
which reportedly worked in February, and it seems it does not now.

Collapse
 
gluups profile image
Gluups

Reading the help of npm was a good idea.
It advised to type
"npm ls".

This pointed out a certain number of dependencies that were missing, including jquery (that I installed ten days ago, but it seems it was necessary to do it again).

Then still "npm ls" until it points out no missing dependency.

After that I tried
"npm uninstall @angular/cli"
"npm install @angular/cli"

But ... Angular still has no version number.

I launched "npm ls" again.
I presume it can help, but it displays 2409 lines.

Perhaps there are some formatting precautions to take ?

Collapse
 
gluups profile image
Gluups • Edited

After that, I deleted the node_modules folder, as @solmarix reminded, and typed
"npm install-ci-test"

Well it is not finished yet, but during the process I saw "ng test", with no error message just after that, which was encouraging.

Then I saw
"Error: src/app/weather/weather.component.ts:27:26 - error TS2564: Property 'instanceCountry' has no initializer and is not definitely assigned in the constructor."

Waw, if it points out an error in my project, it seems that Angular is already much more healthy, is not it ?

Then it stays with no reaction, after a while I presume I shall have to stop that with Ctrl C, and correct the error in the project.

I think I already can thank all of you to have asked good questions -and given good advises.

Probably some steps still remain. I opened another command line window to type
"ng version"

Hum, still no answer.

How much time do you think I have to wait before interrupting the process thinking that it crashed ? I is now mute for half an hour. A moment before becoming mute and keeping the control either, it searched for Chrome, which is not installed.

This is the end of the display (displayed twice) :
√ Browser application bundle generation complete.

Error: src/app/weather/weather.component.ts:27:26 - error TS2564: Property 'instanceCountry' has no initializer and is not definitely assigned in the constructor.

27 @ViewChild('instance') instanceCountry: NgbTypeahead;
~~~~~~~

Collapse
 
gluups profile image
Gluups • Edited

Oh, probably it is still working.

The display finishes like this (I had to insert a few lines and un-indent one to avoid text being interpreted for formatting) :

=============================
Compiling @angular/router/testing : es2015 as esm2015

\Generating browser application bundles (phase: building)...02 10 2021 00:18:11.544:WARN [karma]: No captured browser, open localhost:9876/
02 10 2021 00:18:11.580:INFO [karma-server]: Karma v6.3.4 server started at localhost:9876/
02 10 2021 00:18:11.581:INFO [launcher]: Launching browsers Chrome with concurrency unlimited
02 10 2021 00:18:11.592:INFO [launcher]: Starting browser Chrome
02 10 2021 00:18:11.606:ERROR [launcher]: Cannot start Chrome
Can not find the binary C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
Please set env variable CHROME_BIN
02 10 2021 00:18:11.607:ERROR [launcher]: Chrome stdout:
02 10 2021 00:18:11.608:ERROR [launcher]: Chrome stderr:
√ Browser application bundle generation complete.

Error: src/app/weather/weather.component.ts:27:26 - error TS2564: Property 'instanceCountry' has no initializer and is not definitely assigned in the constructor.

27 @ViewChild('instance') instanceCountry: NgbTypeahead;
~~~~~~~

√ Browser application bundle generation complete.

Error: src/app/weather/weather.component.ts:27:26 - error TS2564: Property 'instanceCountry' has no initializer and is not definitely assigned in the constructor.

27 @ViewChild('instance') instanceCountry: NgbTypeahead;
~~~~~~~

-

02 10 2021 00:59:40.747:INFO [Firefox 90.0 (Windows 10)]: Connected on socket vFbKLwo2sr7gQcmqAAAB with id manual-4817

============================

Sorry to have repeated one part, but there we see there is a new line, oh yes it was when I tried to see the page.
Somewhat higher we see :
02 10 2021 00:18:11.580:INFO [karma-server]: Karma v6.3.4 server started at localhost:9876/

So, I typed that in the address bar of Vivaldi (the default browser), it then displayed a search on it, on Startpage.com.
Hum, it seems I shall have to ask a question on a Vivaldi forum ...

Then I typed the same address in the address bar of Firefox, and Firefox displays this :

=====================================
Karma v 6.3.4 - connected; test: loading;

Firefox 90.0 (Windows 10) is idle

=====================================

Oh well, it is not crashed at all, is serving as usually Angular would.

Back to the command line window :

============================

02 10 2021 01:04:30.916:WARN [Firefox 90.0 (Windows 10)]: Disconnected (0 times) Client disconnected from CONNECTED state (transport close)
Firefox 90.0 (Windows 10) ERROR
Disconnected Client disconnected from CONNECTED state (transport close)

Firefox 90.0 (Windows 10) ERROR

Disconnected Client disconnected from CONNECTED state (transport close)
02 10 2021 01:04:31.435:INFO [Firefox 90.0 (Windows 10)]: Connected on socket M6hniGk5PyIKTGBYAAAD with id manual-8829

=============================

It seems I have got things to modify in my configuration, no ?

Collapse
 
solmarix profile image
solmarix

The same thing happens to me when I run that command for tests in my project, I am doing tests using this reference with Jest for angular I leave you the link in case you want to try use Jasmin and NodeJs --->

xfive.co/blog/testing-angular-fast...

Collapse
 
gluups profile image
Gluups • Edited

In absence of Angular, according to what appears on the screen, it seems the application is built by Karma instead.
So, it seems that instead of
"ng serve --o"
I have to type
"npm test"

The errors are not displayed in the same conditions. I used to see "Cannot get /" on the browser, and the errors in the compilation window.

I see the compilation errors in the compilation window, and for the application errors, I find a "debug" button in the top right corner of the window on the browser, that displays a new tab with the errors.

Concerning the compilation, one error that comes is that Karma systematically tries to open Chrome, which is not installed, so I get an error regularly displayed until I copy the URL from the compilation window, and paste it in the navigation bar of a browser.

Concerning the application, I have to correct migration errors, as some modules were updated and others have to be adapted :

  • some variables are defined in another module than previously
  • the application must return a title in an H1 tag
  • the dependency injections must be corrected, it seems the http has not been provided, maybe because of the first point here above.

So, I need to spend time on this to correct the errors as I can.

Perhaps during that time somebody here can provide information. For instance, to set another default browser it is possible I am a bit longer.

I presume I shall only be able to install Angular once the errors are corrected.
It will then appear in what conditions I can practice a global install.

Collapse
 
jzombie profile image
jzombie

Maybe try from a Bash shell / Linux environment?

Collapse
 
gluups profile image
Gluups • Edited

Hello, do you mean this for my problem to install Angular ?
You know, I once used Bash during two days twenty years ago, so if you can be a little more specific ...
Oh, I forgot to inform about my System :
Microsoft Windows [version 10.0.19043.1237] => version 21H1
If a script is needed, perhaps Powershell can help ?


You know it is my first visit on this forum, it seems I am mixing up a few things ...

Collapse
 
jzombie profile image
jzombie • Edited

I don't know what all you're getting into with this. An npm install in the project should set up most of your dependencies. On a second note, Docker would be your friend here if there's a Dockerfile in the project. You could probably use Docker as your development environment. Windows has always been a major pain for doing any Node.js work, in my opinion.

Thread Thread
 
gluups profile image
Gluups • Edited

Oh, so you mean I should begin to study Docker to be able to install Angular easyerly ?
And ... OK Windows 10 is a mess (probably more than you think), but for a few platforms I practice, it is not a choice.

Collapse
 
solmarix profile image
solmarix

Hello,
You can delete the node_modules folder then you do an npm install so that it installs all the modules again.

Collapse
 
gluups profile image
Gluups • Edited

OK I am going to try that again. I admit I am somewhat troubled nevertheless, as generally ng gives an error message, even if it is cryptic. And the fact that it refuses to give its version number does not sound very good it seems.
As perhaps you saw on Github, when I opened the thread, I tried an option to install clean and test. I thought it would include emptying node_modules.