Open OShuxin opened 5 months ago
error +1
+1
+1
registry.npm.taobao.org这个源的证书过期了。。。
暂时的解决方案是进rax-cli中的node_modules/axios/lib/axios.js中加入如下代码:
var https = require("https");
const httpsAgent = new https.Agent({
rejectUnauthorized: false,
})
axios.defaults.httpsAgent = httpsAgent;
然后命令行跑rax init <your-project-name>
就好了
1、在空目录下安装 rax-cli 2、搜索 registry.npm.taobao.org 修改为 registry.npmmirror.com 3、新建script shell
"init:project": "rax init"
4、执行 npm run init:project
Please describe the problem you meet. What's your project type? App (Build universal application) ? What's your application type? 小程序跨端应用 ? What type of language do you want to use? TypeScript Creating a new Rax project in /Users/oshuxin/Desktop/Myproject/rax-mp-example node:internal/process/promises:279 triggerUncaughtException(err, true / fromPromise /); ^
<ref 1> Error: certificate has expired at TLSSocket.onConnectSecure (node:_tls_wrap:1539:34) at TLSSocket.emit (node:events:513:28) at TLSSocket._finishInit (node:_tls_wrap:953:8) at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:734:12) { code: 'CERT_HAS_EXPIRED', config: { transitional: { silentJSONParsing: true, forcedJSONParsing: true, clarifyTimeoutError: false }, adapter: [Function: httpAdapter], transformRequest: [ [Function: transformRequest] ], transformResponse: [ [Function: transformResponse] ], timeout: 0, xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: -1, validateStatus: [Function: validateStatus], headers: { Accept: 'application/json, text/plain, /', 'User-Agent': 'axios/0.23.0' }, url: 'https://registry.npm.taobao.org/@rax-materials/scaffolds-app-ts', method: 'get', data: undefined }, request: <ref 4> Writable { _writableState: WritableState { objectMode: false, highWaterMark: 16384, finalCalled: false, needDrain: false, ending: false, ended: false, finished: false, destroyed: false, decodeStrings: true, defaultEncoding: 'utf8', length: 0, writing: false, corked: 0, sync: true, bufferProcessing: false, onwrite: [Function: bound onwrite], writecb: null, writelen: 0, afterWriteTickInfo: null, buffered: [], bufferedIndex: 0, allBuffers: true, allNoop: true, pendingcb: 0, constructed: true, prefinished: false, errorEmitted: false, emitClose: true, autoDestroy: true, errored: null, closed: false, closeEmitted: false,
}, response: undefined, isAxiosError: true, toJSON: [Function: toJSON] }