I'm working on a Angular 6.1.8 project with cli 6.2.2 and I suddenly got this error when trying to 'serve' or 'build' with the ng command:
Cannot find module './populate-components'
Error: Cannot find module './populate-components'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (C:\Users\...\node_modules\clean-css\lib\optimizer\level-2\properties\merge-into-shorthands.js:3:26)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (C:\Users\....\node_modules\clean-css\lib\optimizer\level-2\properties\optimize.js:1:89)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
I say suddenly because I really had the impression to change nothing... I really even don't know where to look, I'm stuck... (not so confident in web development :-/)
If you have any clue, thx !
答案 0 :(得分:0)
似乎失去了依赖性。
确保您的依赖项已正确注册到 let array = [];
text.subjects.forEach(subject => (
let obj = {};
obj.code = subject.code;
obj.description = subject.description;
array.push(obj);
));
package.json
然后检查您的组件在npm install populate-components --save
中已声明
app.module.ts
答案 1 :(得分:0)
好的,我找到了解决方案... 仅在“ clean-css”节点模块中引用了populate-modules。 因此,我已经删除了该模块的文件夹,然后再次运行“ npm install”。 现在可以了....