Unable to execute function: Angular 7 Platform-Browser-Dynamic (intermediate value) share is not defined

Recently, I have been working on upgrading our Angular 5 build to version 7. After installing webpack 4, rxjs 6.3.3, and angular 7.0.3, along with taking care of dependencies, I managed to successfully compile the bundle. However, a puzzling error seems to occur when trying to bind the app component to its selector.

t_Host.ngfactory.js? [sm]:1 ERROR TypeError: (intermediate value).share is not a function at new t (platform-browser-dynamic.js:314)

Below is an excerpt from my main.ts file (the file responsible for bootstrapping my component):

import { tap, mapTo, share } from 'rxjs/operators';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app.module';

const platform = platformBrowserDynamic();
platform.bootstrapModule(AppModule);

Additionally, here is part of my vendor.ts file:

import '@angular/platform-browser';
import '@angular/platform-browser-dynamic';
import '@angular/core';
import '@angular/common';
import '@angular/forms';
import '@angular/http';
import '@angular/router';
import '@ng-bootstrap/ng-bootstrap';
import 'ngx-scrollspy';

import 'rxjs/operators/map';
import 'rxjs/operators/mergeMap';
import 'rxjs/operators/share';

The head script imports that were generated seem to be ordered correctly:

<script type="text/javascript" src="0.chunk.js" defer> </script>
<script type="text/javascript" src="polyfills.bundle.js" defer></script>
<script type="text/javascript" src="vendor.bundle.js" defer></script>
<script type="text/javascript" src="main.bundle.js" defer></script></head>

Finally, I will share some relevant information extracted from the package.json file:

"dependencies": {
...
"@angular/animations": "7.0.4",
"@angular/cli": "7.0.6",
"@angular/common": "7.0.4",
"@angular/compiler": "7.0.4",
"@angular/core": "7.0.4",
"@angular/forms": "7.0.4",
"@angular/http": "7.0.4",
"@angular/platform-browser": "7.0.4",
"@angular/platform-browser-dynamic": "7.0.4",
"@angular/platform-server": "7.0.4",
"@angular/router": "7.0.4",
"@angular/upgrade": "7.0.4",
...
"rxjs": "6.3.3",
"rxjs-compat": "6.3.3",
...
"devDependencies": {
...
"@ngtools/webpack": "7.0.6",
"awesome-typescript-loader": "5.2.1",
...
"typescript": "3.1.1",
"webpack": "4.26.0",
"webpack-cli": "3.1.2",
"webpack-dev-middleware": "3.4.0",
"webpack-dev-server": "3.1.10",
"webpack-md5-hash": "0.0.5",
"webpack-merge": "1.0.1"
...
}

Update: In an attempt to resolve the issue, I utilized the rxjs linter available here. Despite running the linting tool, it returned 'Cannot find any possible migrations', leading me to believe I executed the migration correctly.

Answer №1

When I posted this, the problem was that RXJS 6.3.3 was not working well with Angular. To fix it, I had to downgrade to version 6.2.2 which resolved the issue.

 "dependencies": {
   ...
   "rxjs": "6.2.2",
   "rxjs-compat": "6.2.2",
   ...
 }

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

How can I incorporate dynamic fields into a Typescript type/interface?

In my Typescript interface, I have a predefined set of fields like this: export interface Data { date_created: string; stamp: string; } let myData: Data; But now I need to incorporate "dynamic" fields that can be determined only at runtime. This me ...

Having trouble viewing the initial value in an AngularJS2 inputText field

I'm having trouble displaying the initial value in inputText. I'm unsure of what mistake I'm making, but the value should be showing up as expected. Kind regards, Alper <input type="text" value="1" [(ngModel)]="Input.VSAT_input1" name= ...

"Utilize the Image ID to Showcase Images in a MEAN Stack

I am currently working on saving an image in mongoDB and then retrieving it to display from the Angular side. profile.html <input class="file-hide" type="file" (change)="fileChangeEvent($event)" placeholder="Upload file..." /> <button type="b ...

"Exploring the process of setting up a custom environment for ng serve in Angular

According to the angular 6 readme: ## Development server Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. Prior to version 6, I used to run this command for m ...

Utilize Hostbinding in Angular to Inject Style Declarations

Is there a way to efficiently inject multiple style declarations into a component using the @HostBinding decorator? I've been attempting the following: @HostBinding('style') get style(): CSSStyleDeclaration { return { background: &apo ...

Encountered an issue in Typescript with error TS2554: Was expecting 0 arguments but received 1 when implementing useReducer and useContext in React

I've encountered several errors with my useReducers and useContext in my project. One specific error (TS2554) that I keep running into is related to the AuthReducer functionality. I'm facing the same issue with each Action dispatch. I've tri ...

Angular 13 throws NG0301 error message, failing to display the problematic module

Can someone provide assistance? Recently, I upgraded my Angular project from version 11 to version 13: Angular: 13.2.4 ... animations, cdk, common, compiler, compiler-cli, core, forms ... platform-browser, platform-browser-dynamic, router Package ...

Verify the type without making any assumptions about the checked type

Take a look at this type definition: interface ISmth<T> { id: number; data: T; } Now, I am interested in creating an array that contains elements of this type: var a = [{ id: 1, data: [], }, { id: 2, data: 4, }, { id: 3, data: "abc ...

Connecting Ionic 3 with Android native code: A step-by-step guide

I just finished going through the tutorial on helpstack.io and was able to successfully set up the HelpStackExample with android native based on the instructions provided in the GitHub repository. The only issue is that my company project uses Ionic 3. H ...

The functionality of Angular 2 md-radio buttons in reactive forms seems to be hindering the display of md-inputs

Currently, I am following the instructions for implementing reactive form radio buttons on a project using Angular 2.1.2 and Google's MD-alpha.10 Atom-typescript shows no errors in my code. However, when testing the application, I encountered the foll ...

How can TypeScript allow an argument to only accept keys that match another argument?

I'm currently developing a library that deals with linked lists. The current implementation is hardcoded to work with a list node type containing a "next" field that points to the next node of the same type. However, I am looking to make it more flexi ...

React is inferring the type of the 'charts' property in the object literal as 'any[]'

ide: vscode typescript: 2.7.1 react: 16.3.0-alpha.1 interface IState { numbers: number[]; } class CustomCanvas1 extends React.Component<undefined, IState> { constructor(properties: undefined) { super(properties); this.state = { ...

What is included in the final Angular build package selection?

Is there a tool available to track packages included in the final build of an Angular project? For instance: I am using the package "@angular/compiler" as a dependency in my package.json, but it is not a dev dependency. According to the Angular ...

Angular universal issue: 404 error code failing to function properly

After numerous attempts, I find myself at a dead end. Our Angular 11 website requires Universal for SEO purposes, and we have set up a 404 page to redirect when necessary. The issue arises when the redirect returns a status code of 200 instead of 404. To ...

Angular Signal computation does not initiate a re-render

I am currently working on sorting an array of signals within my component. To achieve this, I have wrapped the array in a compute function that sorts it. Below is the relevant code snippet: In the Service file: private readonly _lobbies = signal<Lobby ...

"Having trouble subscribing? The first attempt doesn't seem to be working

I'm currently working on some TypeScript code that searches for the nearest point around a user in need of car assistance by checking a database. Once the nearest point is identified, the code retrieves the phone number associated with it and initiate ...

Issue with remote URL mismatch when attempting to upload to Git using angular-gh-pages

I have just completed transitioning my project to use an angular workspace and now I am looking to deploy my demo application using angular-gh-pages. The repository link is https://github.com/Gillardo/ngx-bootstrap-datetime-popup In my package.json, I hav ...

Issue encountered: The function this.http.post in Ionic 3 is not recognized as a valid function

As someone who is new to Ionic 3 & Angular 4, I am currently working on creating a login page that sends email and password data to an API. However, I keep encountering the error message "this.http.post is not a function". Despite my efforts to find a solu ...

Alter the style type of a Next.js element dynamically

I am currently working on dynamically changing the color of an element based on the result of a function //Sample function if ("123".includes("5")) { color = "boldOrange" } else { let color = "boldGreen" } Within my CSS, I have two clas ...

Exploring the Power of Functions within Angular 4 Subscriptions

I am encountering an issue when trying to call a function within a subscription. The problem arises in this function where I make a call to a subscription that refreshes a token. If the returned value is "true", I then attempt to call the same function aga ...