0

Used the VS2017 angular template and created an app. Then tried to publish it. I also upgraded to Angular 5.

Any idea with this error about ngfactory is about ???

ERROR in ./ClientApp/boot.server.ts Module not found : error : Can't resolve './../$$_gendir/ClientApp/app/app.server.module.ngfacto ry' in 'C:\Users\Matt_Herb\downloads\ibewsurveytemp\ibewsurveytemp\ClientApp' [C:\Users\Matt_Her b\downloads\ibewsurveytemp\ibewsurveytemp\IbewSurveyTemp.csproj] @ ./ClientApp/boot.server.ts 8:0-94

EXEC : ERROR in error : Please update @angular/cli. Angular 5+ requires at least Angular CLI 1.5 + [C:\Users\Matt_Herb\downloads\ibewsurveytemp\ibewsurveytemp\IbewSurveyTemp.csproj] at throwNotSupportedError (C:\Users\Matt_Herb\downloads\ibewsurveytemp\ibewsurveytemp\ packages\compiler-cli\src\ngtools_api.ts:132:9) at Function.NgTools_InternalApi_NG_2.codeGen (C:\Users\Matt_Herb\downloads\ibewsurveyt emp\ibewsurveytemp\packages\compiler-cli\src\ngtools_api.ts:80:11) at _donePromise.Promise.resolve.then (C:\Users\Matt_Herb\downloads\ibewsurveytemp\ibew surveytemp\node_modules\@ngtools\webpack\src\plugin.js:430:58) at at process._tickCallback (internal/process/next_tick.js:188:7) at Function.Module.runMain (module.js:684:11) at startup (bootstrap_node.js:191:16) at bootstrap_node.js:613:3 C:\Users\Matt_Herb\downloads\ibewsurveytemp\ibewsurveytemp\IbewSurveyTemp.csproj(48,5): error MS B3073: The command "node node_modules/webpack/bin/webpack.js --env.prod" exited with code 2.

2 Answers 2

2

ok ... it looks like a problem with your dependencies and so on ..try this:

1 - update your angular cli with : npm install -g @angular/cli

2 - delete your node_modules in your project (maybe with rimraf)

3 - delete your package-lock.json file (if you've one)

4 - try to run in a different folder ng new testProject --skip-install=true (so it generate WITHOUT install packages a new angular project ..)

5 - go in that project and copy the @angular and other dependencies in package.json file and paste in your project .. save the updated package.json
file of your project

6 - run a npm install --f in your project

7 - try to run a ng serve .. and check if the project load

Hope it helps you

Sign up to request clarification or add additional context in comments.

4 Comments

After hours going through one line at a time I finally isolated the problem to one line.. though not sure why.. but the line is.. //import { CookieModule } from 'ngx-cookie';
very happy you've fixed it!!
it randomly came up again.. Now I'm starting to think my npm is all messed up. I'm going to cry.
I've got it too, not using CookieModule :(
1

Angular 5 needs to use a different compiler plugin to Angular 4,

Try search/replace 'AotPlugin' with 'AngularCompilerPlugin' in webpack.config.js

see: https://www.npmjs.com/package/@ngtools/webpack

The next problem I ran into was that test files fail to compile when publishing, The 'exclude' properties on webpack rules and on AngularCompilerPlugin constructor do not seem to work, so I've resorted to excluding these in tsconfig.json:

  "exclude": [ "bin", "node_modules", "**/*.spec.ts" ],

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.