About npm install after the download is complete, run the project error Module not found: Error: Can not resolve 'tls' in' D: \ frontEnd \ node_modules \

ERROR in ./node_modules/request/lib/har.js
Module not found: Error: Can't resolve 'fs' in 'D:\frontEnd\node_modules\request\lib'
 @ ./node_modules/request/lib/har.js 3:9-22
 @ ./node_modules/request/request.js
 @ ./node_modules/request/index.js
 @ ./src/GithubApiService.ts
 @ ./src/index.ts

ERROR in ./node_modules/forever-agent/index.js
Module not found: Error: Can't resolve 'tls' in 'D:\frontEnd\node_modules\forever-agent'
 @ ./node_modules/forever-agent/index.js 7:10-24
 @ ./node_modules/request/request.js
 @ ./node_modules/request/index.js
 @ ./src/GithubApiService.ts
 @ ./src/index.ts

ERROR in ./node_modules/tunnel-agent/index.js
Module not found: Error: Can't resolve 'tls' in 'D:\frontEnd\node_modules\tunnel-agent'
 @ ./node_modules/tunnel-agent/index.js 4:10-24
 @ ./node_modules/request/lib/tunnel.js
 @ ./node_modules/request/request.js
 @ ./node_modules/request/index.js
 @ ./src/GithubApiService.ts
 @ ./src/index.ts
i 「wdm」: Failed to compile.

 

Scenario 1, if can not resolve 'xxxx' to install npm install 'xxx' is like, first uninstall the component npm uninstall 'xxx', then npm install 'xxx', or delete all folders again npm install node_modules

 

Scenario 2 If the on-fs, tls, net and other components Cant resolve the situation, the installed packages are installed but still error, you can try to add the file in webpack.config.js   

node: {

        fs: 'empty',

        net:'empty',

        tls:"empty",

   }

Released four original articles · won praise 2 · Views 3378

Guess you like

Origin blog.csdn.net/Fall_In_Love_With/article/details/101020574