src / server.ts(17,22)中的角度SSR错误:错误TS2307:找不到模块“路径”

时间:2018-12-26 03:14:01

标签: angular express ssr

经过数小时的尝试,看到了这个好主意,然后输入“ npm run build:ssr”时,它会输出此错误

请帮助!

"ERROR in src/server.ts(17,22): error TS2307: Cannot find module 'path'.         
src/server.ts(19,30): error TS2307: Cannot find module 'fs'.                    
src/server.ts(34,14): error TS2580: Cannot find name 'process'. Do you need to i
nstall type definitions for node? Try `npm i @types/node`.                      
src/server.ts(36,26): error TS2580: Cannot find name 'process'. Do you need to i
nstall type definitions for node? Try `npm i @types/node`.                      
src/server.ts(48,55): error TS2580: Cannot find name 'require'. Do you need to i
nstall type definitions for node? Try `npm i @types/node`.                      
src/server.ts(52,30): error TS2580: Cannot find name 'require'. Do you need to i
nstall type definitions for node? Try `npm i @types/node`.                      

npm ERR! code ELIFECYCLE                                                        
npm ERR! errno 1                                                                
npm ERR! project-name@0.0.0 build:client-and-server-bundles: `ng build --prod &&
 ng build --prod --app 1 --output-hashing=false`                                
npm ERR! Exit status 1                                                          
npm ERR!                                                                        
npm ERR! Failed at the project-name@0.0.0 build:client-and-server-bundles script
.                                                                               
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.                                                              

npm ERR! A complete log of this run can be found in:                            
npm ERR!     C:\Users\Cristian\AppData\Roaming\npm-cache\_logs\2018-12-26T03_08_
11_820Z-debug.log                                                               
npm ERR! code ELIFECYCLE                                                        
npm ERR! errno 1                                                                
npm ERR! project-name@0.0.0 build:ssr: `npm run build:client-and-server-bundles 
&& npm run webpack:server`                                                      
npm ERR! Exit status 1"

0 个答案:

没有答案