Aspnetcore-angular-universal: Cannot find module './ngfactory/app/server-app.module.ngfactory'. while publishing

Created on 8 Jun 2017  路  9Comments  路  Source: TrilonIO/aspnetcore-angular-universal

Hi Mark,

I'm having the error:

image

I read here that I should ignore the error but I do not know how

Visual Studio has been upgraded and since that is presented to the error when executing or publishing the project

image

image

How can I do to skip this error ? Thanks

Most helpful comment

Do you get more useful error information when you run (via the command line at project root):

npm run build:aot

I was able to solve solve similar errors on publishing by changing component variables from private to public etc and found out about these by running the above command.

All 9 comments

272 I don't have this issue on publish, just a TS error. Does not stop Build or Webpack

In my case, after upgrading visual studio 2017 to 15.2 (26430.12)

image

What errors appear in the Output console in VS?

Hi Mark,

image

Do you get more useful error information when you run (via the command line at project root):

npm run build:aot

I was able to solve solve similar errors on publishing by changing component variables from private to public etc and found out about these by running the above command.

You can also install WebPackTaskRunner and run Build Dev to get more verbose output

Have you tried the npm run build:AoT as Peter mentioned?
There must be some kind of error whe statically analyzing the code for pre compilation. @cristiancamiloperezlopez

I getting the same issue, here is the log file:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'build:aot' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild:aot', 'build:aot', 'postbuild:aot' ]
5 info lifecycle [email protected]~prebuild:aot: [email protected]
6 silly lifecycle [email protected]~prebuild:aot: no script for prebuild:aot, continuing
7 info lifecycle [email protected]~build:aot: [email protected]
8 verbose lifecycle [email protected]~build:aot: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~build:aot: PATH: C:Program Filesnodejsnode_modulesnpmbinnode-gyp-bin;C:UsersDanielDocumentsVisual Studio 2017ProjectsTSMSnode_modules.bin;C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;C:WINDOWSSystem32WindowsPowerShellv1.0;C:Program Files (x86)ATI TechnologiesATI.ACECore-Static;C:Program FilesMicrosoft SQL Server130ToolsBinn;C:Program Filesdotnet;C:Program Files (x86)QuickTimeQTSystem;C:Program Filesnodejs;C:UsersDanielAppDataLocalMicrosoftWindowsApps;C:UsersDanielAppDataRoamingnpm
10 verbose lifecycle [email protected]~build:aot: CWD: C:UsersDanielDocumentsVisual Studio 2017ProjectsTSMS
11 silly lifecycle [email protected]~build:aot: Args: [ '/d /s /c',
11 silly lifecycle 'webpack --env.aot --env.client & webpack --env.aot --env.server' ]
12 silly lifecycle [email protected]~build:aot: Returned: code: 2 signal: null
13 info lifecycle [email protected]~build:aot: Failed to exec build:aot script
14 verbose stack Error: [email protected] build:aot: webpack --env.aot --env.client & webpack --env.aot --env.server
14 verbose stack Exit status 2
14 verbose stack at EventEmitter. (C:Program Filesnodejsnode_modulesnpmlibutilslifecycle.js:255:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess. (C:Program Filesnodejsnode_modulesnpmlibutilsspawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:891:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid [email protected]
16 verbose cwd C:UsersDanielDocumentsVisual Studio 2017ProjectsTSMS
17 error Windows_NT 10.0.15063
18 error argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "build:aot"
19 error node v6.11.0
20 error npm v3.10.10
21 error code ELIFECYCLE
22 error [email protected] build:aot: webpack --env.aot --env.client & webpack --env.aot --env.server
22 error Exit status 2
23 error Failed at the [email protected] build:aot script 'webpack --env.aot --env.client & webpack --env.aot --env.server'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the angular4-aspnetcore-universal package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error webpack --env.aot --env.client & webpack --env.aot --env.server
23 error You can get information on how to open an issue for this project with:
23 error npm bugs angular4-aspnetcore-universal
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls angular4-aspnetcore-universal
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

Thank you @peterdobson
It was exactly what you said

Had
Private translate: TranslateService,
And it is
Public translate: TranslateService,

In my component

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ketrex2 picture ketrex2  路  18Comments

alexbenitez picture alexbenitez  路  14Comments

johnkattenhorn picture johnkattenhorn  路  15Comments

ORuban picture ORuban  路  15Comments

Gaulomatic picture Gaulomatic  路  26Comments