Angular-cli: Module not found: Error: Can't resolve '@angular/forms/src/directives/shared'

Created on 29 Mar 2017  路  8Comments  路  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

- [x ] bug report -> please search issues before submitting
- [ ] feature request

Versions.

@angular/cli: 1.0.0
node: 6.9.4
os: win32 x64
@angular/common: 4.0.0
@angular/compiler: 4.0.0
@angular/core: 4.0.0
@angular/forms: 4.0.0
@angular/http: 4.0.0
@angular/platform-browser: 4.0.0
@angular/platform-browser-dynamic: 4.0.0
@angular/router: 4.0.0
@angular/cli: 1.0.0
@angular/compiler-cli: 4.0.0

Repro steps.

I have a directive where I import:

import {isPropertyUpdated} from "@angular/forms/src/directives/shared";

When I run npm start I get the error.

The log given by the failure.

ERROR in ./src/app/directives/contenteditable-model.directive.ts
Module not found: Error: Can't resolve '@angular/forms/src/directives/shared' in 'C:\Users\landesko\projectDir\angular\src\app\directives'
@ ./src/app/directives/contenteditable-model.directive.ts 12:0-73
@ ./src/app/app.module.ts
@ ./src/main.ts
@ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts

Desired functionality.

Apparently this has something to do with deep imports, however I need to make use of isPropertyUpdated. Is there an alternative?

Mention any other details that might be useful.

The code I use is similar to the code found here:
http://stackoverflow.com/a/40183067/3417943

All 8 comments

HI @landesko ,

I was not able to replicate this issue using the same versions you have. Any chance you can upload a repro of this error.

Thanks!

5707 The same issue is found there as well.

check out your imports on this ts file. probably you misuse a module

I'm having this same issue post 4.0 update with:

import {isPropertyUpdated} from "@angular/forms/src/directives/shared";

throwing this error:

Failed to compile.

./src/app/shared/contenteditable/contenteditable-model.ts
Module not found: Error: Can't resolve '@angular/forms/src/directives/shared' in '/Users/njonas/Code/lists/src/app/shared/contenteditable'
 @ ./src/app/shared/contenteditable/contenteditable-model.ts 11:0-73
 @ ./src/app/shared/contenteditable/index.ts
 @ ./src/app/tasks/tasks.module.ts
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts

I get that 4.0 doesn't allow deep imports anymore, but how else can I useisPropertyUpdated?

I am not misusing a module. It has to do with the deep import functionality being deprecated. Please read the post before commenting.

Heya, can you report this in https://github.com/angular/angular instead? This isn't something that can be addressed on the CLI repro, because it has to do with how Angular itself is packaged.

Where is the tracking for this bug? I continue running into this, even with 4.1.3.

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._

Was this page helpful?
0 / 5 - 0 ratings