ultimatecourses / angular-pro-app-seed

Seed project for Angular Pro final application
112 stars 360 forks source link

AoT: Can't resolve ngfactory #2

Closed markgoho closed 7 years ago

markgoho commented 7 years ago

Getting some odd errors when trying to run yarn build:production:

ERROR in ./src/main.ts
Module not found: Error: Can't resolve './../ngfactory/src/app/app.module.ngfactory' in 'C:\Users\Mark\Documents\GitHub\angular-pro-app-seed\s
rc'
 @ ./src/main.ts 3:0-81
 @ multi zone.js/dist/zone ./src/main.ts

ERROR in ./ngfactory lazy
Module not found: Error: Can't resolve 'C:\Users\Mark\Documents\GitHub\angular-pro-app-seed\ngfactory\src\auth\login\login.module.ngfactory.ts
' in 'C:\Users\Mark\Documents\GitHub\angular-pro-app-seed\ngfactory'
 @ ./ngfactory lazy
 @ ./node_modules/@angular/core/@angular/core.es5.js
 @ ./src/main.ts
 @ multi zone.js/dist/zone ./src/main.ts

ERROR in ./ngfactory lazy
Module not found: Error: Can't resolve 'C:\Users\Mark\Documents\GitHub\angular-pro-app-seed\ngfactory\src\auth\register\register.module.ngfact
ory.ts' in 'C:\Users\Mark\Documents\GitHub\angular-pro-app-seed\ngfactory'
 @ ./ngfactory lazy
 @ ./node_modules/@angular/core/@angular/core.es5.js
 @ ./src/main.ts
 @ multi zone.js/dist/zone ./src/main.ts

ERROR in ./ngfactory lazy
Module not found: Error: Can't resolve 'C:\Users\Mark\Documents\GitHub\angular-pro-app-seed\ngfactory\src\health\schedule\schedule.module.ngfa
ctory.ts' in 'C:\Users\Mark\Documents\GitHub\angular-pro-app-seed\ngfactory'
 @ ./ngfactory lazy
 @ ./node_modules/@angular/core/@angular/core.es5.js
 @ ./src/main.ts
 @ multi zone.js/dist/zone ./src/main.ts

ERROR in ./ngfactory lazy
Module not found: Error: Can't resolve 'C:\Users\Mark\Documents\GitHub\angular-pro-app-seed\ngfactory\src\health\meals\meals.module.ngfactory.
ts' in 'C:\Users\Mark\Documents\GitHub\angular-pro-app-seed\ngfactory'
 @ ./ngfactory lazy
 @ ./node_modules/@angular/core/@angular/core.es5.js
 @ ./src/main.ts
 @ multi zone.js/dist/zone ./src/main.ts

ERROR in ./ngfactory lazy
Module not found: Error: Can't resolve 'C:\Users\Mark\Documents\GitHub\angular-pro-app-seed\ngfactory\src\health\workouts\workouts.module.ngfa
ctory.ts' in 'C:\Users\Mark\Documents\GitHub\angular-pro-app-seed\ngfactory'
 @ ./ngfactory lazy
 @ ./node_modules/@angular/core/@angular/core.es5.js
 @ ./src/main.ts
 @ multi zone.js/dist/zone ./src/main.ts

The build does appear to complete, but then gives me some more errors:

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! ua-pro-app-seed@0.0.0 build: `cross-env NODE_ENV=production webpack -p`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the ua-pro-app-seed@0.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Mark\AppData\Roaming\npm-cache\_logs\2017-08-11T19_52_49_924Z-debug.log

I tried this with my master branch that I've been coding along with your videos, then jumped to the last branch (25 firebase) and got the same errors.

markgoho commented 7 years ago

Okay, I ran rm -rf node_modules and then ran yarn and the build worked just fine.

I've been running yarn upgrade each new day I work on the project, so must be something has changed Angular that's causing the build to fail.

Marcidius commented 6 years ago

I'm getting this exact same error when I go and deploy this to Firebase when following along in the second video. I had this issue locally too just like you said but removing the node_modules folder and running yarn fixed it (thanks for your suggestion!). However, deploying this project as instructed in the video yields the same error with very little to work with.

Marcidius commented 6 years ago

I did an "rm -rf build" and did another "yarn build:production" and a redeploy via firebase deploy and it worked! Nothing more to see here.

ux-engineer commented 5 years ago

Getting this error same as did Marcidius over a year ago. Already switched using Node version 8.11.1 but that might to too new also.

ArwinStrating commented 5 years ago

I also encountered this issue while trying to build and deploy the application for the first time. My fix was to install enhanced-resolve@3.3.0:

npm install enhanced-resolve@3.3.0

petogriac commented 4 years ago

thanks @ArwinStrating that helped with the ngfactory issue, I also had an issue with @types/bluebird package when using npm run build:production

And also when trying to deploy to firebase with public: "" I got an error: Error: Must supply a public directory using "public" in each "hosting" config. changing it to public:'.' helped