【解决】Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/index.js

问题描述

nodejs要写一个post请求,用到了axios,但是在编译的时候报了如下错误:

 Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/index.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/axios.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/utils.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/helpers/bind.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/core/Axios.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/core/mergeConfig.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/defaults/index.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/helpers/formDataToJSON.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/cancel/CanceledError.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/cancel/CancelToken.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/cancel/isCancel.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/env/data.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/helpers/toFormData.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/core/AxiosError.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/helpers/spread.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/helpers/isAxiosError.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/core/AxiosHeaders.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/adapters/adapters.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/helpers/HttpStatusCode.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/helpers/buildURL.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/core/InterceptorManager.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/core/dispatchRequest.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/core/buildFullPath.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/helpers/validator.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/defaults/transitional.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/helpers/toURLEncodedForm.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/platform/index.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/platform/node/classes/FormData.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/helpers/parseHeaders.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/adapters/http.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/adapters/xhr.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/helpers/AxiosURLSearchParams.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/core/transformData.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/helpers/isAbsoluteURL.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/helpers/combineURLs.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/platform/node/index.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/core/settle.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/helpers/fromDataURI.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/helpers/AxiosTransformStream.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/helpers/formDataToStream.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/helpers/readBlob.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/helpers/callbackify.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/helpers/cookies.jsx
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/helpers/isURLSameOrigin.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/helpers/parseProtocol.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/helpers/speedometer.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/platform/node/classes/URLSearchParams.js
> Warning Failed to make bytecode node18-x64 for file /snapshot/xxx/node_modules/axios/lib/helpers/throttle.js

问题分析

是axios和pkg版本对应的问题,我的pkg是5.8.1,最开始安装的axios版本是1.7.7,nodejs版本是20.18.0

问题解决

更换axios版本为0.27.0

 

解决步骤:

1.npm list axios 查询axios版本

2.删除node_modules中的axios

3.pm list axios查询是否正确删除

4.npm install axios@0.27.0 --save 安装axios

5.重新npm run local 问题解决

 

备用命令

npm list axios
npm install axios@0.27.0 --save
npm run local

参考

PKG build file - axios - 码客

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值