Error: ENOENT: no such file or directory, open '/code/bridge.js'  
    at openSync (fs.js:462:3)  
    at readFileSync (fs.js:364:35)  
    at (/code/index.js:45:84942)  
    at r (/code/index.js:1:124)  
    at (/code/index.js:227:321872)  
    at r (/code/index.js:1:124)  
    at (/code/index.js:227:321786)  
    at r (/code/index.js:1:124)  
    at (/code/index.js:227:92717)  
    at r (/code/index.js:1:124)                                      
                                        淡绿色的小鬼                                                                                
                                        
                                - 发布:2022-04-27 00:16
 - 更新:2022-04-27 17:21
 - 阅读:639
 
【报Bug】uniCloud.httpclient.request代理报ENOENT: no such file or directory, open '/code/bridge.js'
                                分类:uniCloud
                            
                            
                            
                            
                                                    产品分类: uniCloud/App
示例代码:
                                    
                                    
                                         
                                
                                                                                                操作步骤:
                                    
                                        const res = await uniCloud.httpclient.request(`${this.baseURL}${url}`, {  
            method,  
            // data: {  
            //   test: 'testValue'  
            // },  
            headers: {  
                'Content-Type': 'application/json',  
                'X-MBX-APIKEY': this.apiKey,  
                // 'User-Agent': `${constants.appName}/${constants.appVersion}`  
            },  
            contentType: 'json', // 指定以application/json发送data内的数据  
            dataType: 'json', // 指定返回值为json格式,自动进行parse  
            timeout: this.timeout,  
            enableProxy: this.proxy ? true : false,  
            proxy: this.proxy ? this.proxy : ""  
        })
                                     
                                
                                                                                                const res = await uniCloud.httpclient.request(`${this.baseURL}${url}`, {  
            method,  
            // data: {  
            //   test: 'testValue'  
            // },  
            headers: {  
                'Content-Type': 'application/json',  
                'X-MBX-APIKEY': this.apiKey,  
                // 'User-Agent': `${constants.appName}/${constants.appVersion}`  
            },  
            contentType: 'json', // 指定以application/json发送data内的数据  
            dataType: 'json', // 指定返回值为json格式,自动进行parse  
            timeout: this.timeout,  
            enableProxy: this.proxy ? true : false,  
            proxy: this.proxy ? this.proxy : ""  
        })                                    预期结果:
                                    
                                    
                                        获取到请求结果
                                     
                                
                                                                                                获取到请求结果
实际结果:
                                    
                                    
                                        Error: ENOENT: no such file or directory, open '/code/bridge.js'  
    at openSync (fs.js:462:3)  
    at readFileSync (fs.js:364:35)  
    at (/code/index.js:45:84942)  
    at r (/code/index.js:1:124)  
    at (/code/index.js:227:321872)  
    at r (/code/index.js:1:124)  
    at (/code/index.js:227:321786)  
    at r (/code/index.js:1:124)  
    at (/code/index.js:227:92717)  
    at r (/code/index.js:1:124)  
                                     
                                
                                                            Error: ENOENT: no such file or directory, open '/code/bridge.js'  
    at openSync (fs.js:462:3)  
    at readFileSync (fs.js:364:35)  
    at (/code/index.js:45:84942)  
    at r (/code/index.js:1:124)  
    at (/code/index.js:227:321872)  
    at r (/code/index.js:1:124)  
    at (/code/index.js:227:321786)  
    at r (/code/index.js:1:124)  
    at (/code/index.js:227:92717)  
    at r (/code/index.js:1:124)                                      bug描述:
代理功能在本地测试正常,上传到服务器报这个错误
            
            
            
            
jiangrenjin
我今天也遇到了这个问题,,还没解决呀
2022-08-21 18:06