The connections between module dependencies are unable to be resolved

I'm encountering an issue with the npm link command.

Here's the scenario: I have two Angular apps -

1) app-core (published locally)
2) app-main

The app-core module has the following dependencies (installed via npm):

core
rxjs
zone
ng2-cache // Important!
etc...


The app-main module has these dependencies:

core
rxjs
http
etc...


I've linked the app-core module to my local npm using symbolic links:

npm link

This module has been linked globally.


Now, I'm using app-core inside app-main by running:

npm link app-core

Everything seems fine so far, but when I try to build app-main, I encounter the following errors:

ERROR in ../app-core/dist/core/services/remote.service.js
Module not found: Error: Can't resolve 'ng2-cache/ng2-cache' in 'C:\Dhaval\app-core\dist\core\services'
 @ ../app-core/dist/core/services/remote.service.js 14:18-48
 @ ../app-core/dist/upoint.core.js
 @ ./src/shared/shared.module.ts
 @ ./src/app-features/app-features.module.ts
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts
webpack: Failed to compile.

Explanation: The issue is that the ng2-cache dependency used within app-core is a custom module, creating a nesting situation where a custom module (ng2-cache) is being used inside another module (app-core), which is then used inside app-main.

This problem is causing trouble for me. Any suggestions on how to resolve it?

Your help would be greatly appreciated!

Answer №1

Linked projects do not automatically install dependencies of their dependencies. These dependencies are only installed when the project is published and then installed in a traditional manner.

To resolve this issue, consider adding a dependency on the same library in the app-main project.

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

What sets apart regular component styles from nested styles within the :host selector?

Here is an example of component-level styling for a component with the default view encapsulation value of ViewEncapsulation.Emulated: :host h2 { color: red; } When compiled, the CSS will look like this: [_nghost-c0] h2[_ngcontent-c0] { color: r ...

What are the steps to incorporating ng2-dnd with a background-image?

I am currently utilizing the ng2-dnd module to enable sorting of a list. While the functionality for sorting and dragging is working smoothly, there's one issue - users can only drag by clicking on the text within my element. My goal is to allow user ...

employing flush for lodash's throttle wrapper

When using TypeScript with JavaScript and Angular: I am trying to use the throttle decorator from lodash to limit an API call while a user is navigating around the page, ensuring that it fires before they leave the site. In my TypeScript constructor, I h ...

Another way to execute "npm run eject"

What happens to a ReactJS app project when I close the CLI while the Node.js Package Manager is running the developer server with the "npm start" command? Will it continue running in the background? If the ReactJS app project does run in the background, h ...

Get rid of the "No data" tag from the nz-table within a Simple Component

(Apologies for any language errors, English is not my native tongue) I'm working on a web page utilizing the smart and dumb components architecture. The issue I'm facing is that after fetching data from an API in my smart component, the table in ...

Apologies, there seems to be an issue with nodist while attempting to initialize a new npm project

I'm currently following a guide on GitHub at this link. However, every time I run the command npm init, I encounter the error message: Sorry, there's an issue with nodist. It couldn't resolve node version %s: %s 11.13.0. No matching versio ...

Creating a customized environment variable for the global scope using Webpack build

Recently, I encountered a challenge with my Vue application which is compiled using Webpack. I wanted to include a variable in the 'npm run dev' command so that I could access it globally within the project. After running 'npm --brand=foo ru ...

The TypeScript compiler is generating node_modules and type declaration files in opposition to the guidelines outlined in the tsconfig.json file

For the past week, I've been trying to troubleshoot this issue and it has me completely puzzled. What's even more puzzling is that this app was compiling perfectly fine for months until this problem occurred seemingly out of nowhere without any c ...

Encountering a Caution Message When Attempting to Install Yeomen

Upgrade to a higher version is recommended at [email protected], but how should I proceed? Please provide guidance on achieving this upgrade. C:\Program Files>npm install -g yo npm WARN deprecated <a href="/cdn-cgi/l/email-protection" clas ...

Is there a workaround for unresolved symlink requirements when using npm link?

Creating an NPM package often involves using the following: npm link This allows for making modifications to a package called <myPackage> during development without constantly having to publish and unpublish! Developers can make changes locally and ...

What is the best way to display the output of a Set-typed function using a class key in my code?

I'm currently working on developing a function that can return a Set containing the keys of a class. However, I am struggling to determine the correct definition for this function. class Bot { public no01: number; public no02: number; construct ...

Why isn't the unit test passing when it clearly should be?

I am encountering an issue with testing a simple function that I have created. Despite the fact that the function works correctly in practice, it is not being tested properly... Explanation of how my function operates (While it functions as intended, the ...

Cannot detect react-script in the "npm run build" command when setting up the create-next-app project

Here is the content of my package.json file: "name": "food-recipe", "version": "0.1.0", "private": true, "scripts": { "dev": "next dev", "build": &quo ...

What is the reason behind localStorage.getItem consistently returning a string value?

Something strange is happening. In the lib.dom.d.ts file, the type for localstorage.getItem shows as 'string | null', but in my app it always returns a string. Why is this discrepancy occurring? ...

After adding the exclude property to angular-cli.json, the spec files are now being linted

I am working on an Angular 4 application and have manually created two .spec files for a specific class. When I use the nglint command, it successfully lints these two files. However, the spec files that were automatically generated when I created a compon ...

Ways to determine the number of duplicate items in an Array

I have an array of objects that contain part numbers, brand names, and supplier names. I need to find a concise and efficient way to determine the count of duplicate objects in the array. [ { partNum: 'ACDC1007', brandName: 'Electric&apo ...

I am in need of a customized 'container' template that will display MyComponent based on a specific condition known as 'externalCondition'. MyComponent includes the usage of a Form and formValidation functionalities

container.html <div ngIf="externalCondition"> <!--Initially this is false. Later became true --!> <my-component #MyComponentElem > </my-component> <button [disabled]= "!myComponentElemRef.myDetailsF ...

Encountering an issue with Next.js, Typescript, and mongoose when attempting to use `let cached = global.mongoose

I attempted to create a cached mongoose connection for my Next.js + Typescript application, but the code I used was: let cached = global.mongoose; if (!cached) { cached = global.mongoose = { conn: null, promise: null }; } The use of global.mongoose res ...

Error in Angular5 httpClient GET request: Unable to access the 'toLowerCase' property because it is undefined

When attempting to retrieve a list of Users from an API, I encountered the following error: TypeError: Cannot read property 'toLowerCase' of undefined at HttpXsrfInterceptor.intercept (http.js:2482) at HttpInterceptorHandler.handle (http.js:1796 ...

Upon the initial loading of GoJS and Angular Links, nodes are not bypassed

Hey there, I'm currently working on a workflow editor and renderer using Angular and GoJS. Everything seems to be in order, except for this one pesky bug that's bothering me. When the page first loads, the links don't avoid nodes properly. H ...