找不到模块:错误:无法解析'path'

时间:2018-05-18 00:43:28

标签: node.js typescript webpack angular-cli

我有一个Angular CLI项目,我刚刚升级到Angular 6.现在,当我尝试构建我的应用程序时,出现以下错误:

ERROR in ./node_modules/postcss/lib/input.js Module not found: Error: Can't resolve 'path' in '/Users/jattardi/code/myproject/node_modules/postcss/lib' ERROR in ./node_modules/postcss/lib/map-generator.js Module not found: Error: Can't resolve 'path' in '/Users/jattardi/code/myproject/node_modules/postcss/lib' ERROR in ./node_modules/postcss/lib/previous-map.js Module not found: Error: Can't resolve 'path' in '/Users/jattardi/code/myproject/node_modules/postcss/lib' ERROR in ./node_modules/htmlparser2/lib/WritableStream.js Module not found: Error: Can't resolve 'stream' in '/Users/jattardi/code/myproject/node_modules/htmlparser2/lib'

我很困惑。首先,我甚至没有直接在我的项目中使用postcsshtmlparser2。所以他们必须是其他东西的依赖。

但是节点模块中没有pathstream吗?怎么可能无法解决它们?

1 个答案:

答案 0 :(得分:9)

npm install path
npm install stream

成功了