marktext 编译过程
编译尝试
- 编译发布的release版本失败。
- 克隆代码失败
- 获取最新的开发版本失败
开发版本编译接近成功
npm config set ELECTRON_MIRROR https://npm.taobao.org/electron/
yarn run build 失败
失败原因:
electron-v13.6.9-darwin-x64.zip未能下载成功。
解决方法:
- https://github.com/electron/electron/releases 下载对应的版本。
- cd ~/Library/Caches/electron
- 将对应版本的electron-v13.6.9-darwin-x64.zip和SHASUMS256.txt拷贝到此目录下。
- 继续编译。
yarn run build 继续失败
失败提示:unable to build chain to self-signed root for signer,CodeSign failed
失败原因: 签名失败。
编译发布的版本:失败
Cocoa/Cocoa.h 引用错误
#import <Cocoa/Cocoa.h>
^~~~~~~~~~~~~~~
1 error generated.
To Reproduce
Steps to reproduce the behaviour:
导入Cocoa存在编译错误,
运行: xcrun --sdk macosx --show-sdk-path
export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk
添加SDKROOT添加到环境变量中,.bash_profile中。
export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk
node-addon-api 引用错误
⠙ Building module: keytar, Completed: 5In file included from ../src/async.cc:4:
In file included from ../node_modules/node-addon-api/napi.h:2981:
../node_modules/node-addon-api/napi-inl.h:1837:24: error: use of undeclared identifier 'napi_detach_arraybuffer'
napi_status status = napi_detach_arraybuffer(_env, _value);
^
⠹ Building module: keytar, Completed: 54 errors generated.
make: *** [Release/obj.target/keytar/src/async.o] Error 1
✖ Rebuild Failed
An unhandled error occurred inside electron-rebuild
node-gyp failed to rebuild '/Users/demo/Downloads/code/marktext-0.16.3/node_modules/keytar'.
Error: `make` failed with exit code: 2
Error: node-gyp failed to rebuild '/Users/demo/Downloads/code/marktext-0.16.3/node_modules/keytar'.
Error: `make` failed with exit code: 2
at ModuleRebuilder.rebuildNodeGypModule (/Users/demo/Downloads/code/marktext-0.16.3/node_modules/electron-rebuild/lib/src/module-rebuilder.js:193:19)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Rebuilder.rebuildModuleAt (/Users/demo/Downloads/code/marktext-0.16.3/node_modules/electron-rebuild/lib/src/rebuild.js:190:9)
at async Rebuilder.rebuild (/Users/demo/Downloads/code/marktext-0.16.3/node_modules/electron-rebuild/lib/src/rebuild.js:152:17)
at async /Users/demo/Downloads/code/marktext-0.16.3/node_modules/electron-rebuild/lib/src/cli.js:146:9
error Command failed with exit code 255.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 255.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
需要对应的node-addon-api版本。
解决: 升级package.json各个第三方库。
node 镜像源
搜索地址:http://cnpmjs.org/
registry地址:http://r.cnpmjs.org/
使用方法:
临时使用npm --registry https://registry.npm.taobao.org install express
持久使用npm config set registry https://registry.npm.taobao.org
配置完成后可通过命令验证
npm config get registry
网友评论