Reputation: 1778
I am trying to compile an Angular2 application and getting this error when I issue ng serve
command:
C:\Projects\All\MyAngularApp>ng serve
Cannot find module './$data'
Error: Cannot find module './$data'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Projects\All\MyAngularApp\node_modules\ajv\lib\ajv.js:10:23)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Projects\All\MyAngularApp\node_modules\schema-utils\dist\validateOptions.js:15:12)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
Is there a good resource that explains how to debug these issues?
This is not the first time we are getting these build errors, but previously we were able to resolve them by running npm install
command.
Upvotes: 3
Views: 4068
Reputation: 401
It happened to me because our build definition requires node_modules to be checked in. I got three errors because of this from har-validator\node_modules\ajv\lib, schema-utils\node_modules\ajv\lib, and webpack\node_modules\ajv\lib. I manually deleted ajv\lib from source control (and ofc locally) the build then succeeded.
Hope this helps.
Upvotes: 3