npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

hello_publishing-native-pre-gyp

v1.0.4

Published

在hello-publishing-native基础上,node-pre-gyp预编译

Readme

在hello-publishing-native基础上,node-pre-gyp预编译

常用命令: npm i # 安装依赖库

arch等于当前node的arch

npm run build:node # 编译出node环境 npm run build:electron --target=8.2.5 --toolset=v141 # toolset指定vs编译工具 npm run upload # 上传 npm search 'hello_publishing-native-pre-gyp' # 最新发布版本 预拉取关键日志:node-pre-gyp http GET

远程:https://bingjunliu.cn/hello_publishing/node_modules/hello-v1.0.0-node-v57-darwin-x64.tar.gz 本地:lib/node-v57-darwin-x64-unknown/grpc_node.nod 规则为: 远程位置:{host}/{package_name} 本地位置:{module_path} package_name默认是{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz

必需配置 "binary": { "module_name": "hello", "module_path": "lib/{node_abi}-{platform}-{arch}-{libc}", "host": "https://bingjunliu.cn/hello_publishing/" } 具体: node_abi: node-v57 或 electron-v4.0,来自 node-v${NODE_MODULE_VERSION} 或 ${runtime}-v${target} platform: darwin,来自:node -p process.platform arch: x64 或 ia32,来自:node -p process.arch libc: unknown-v1.0.0-node-v57-darwin-x64

打包流程: node node_modules/node-pre-gyp/bin/node-pre-gyp rebuild package # 源码编译,tar.gz打包,结果在build/stage node node_modules/node-pre-gyp/bin/node-pre-gyp --runtime=electron --target=4.0.3 --dist-url=https://atom.io/download/electron rebuild package 把tar.gz放到https://bingjunliu.cn/hello_publishing

具体问题: problem1: 预编译包tar.gz上传bingjunliu.cn

  1. npm run build:node
  2. cp build/stage/hello-* ~/Documents/205_rsync_dir/html/hello_publishing
  3. cd ~/Documents/205_rsync_dir; sh html_rsync.sh push problem2: js发布到npmjs
  4. npm publish problem3: 代码提交到git
  5. git push

问题:building.gpy能同时对node-pre-gyp与node-gyp通用吗 -- 通用的,仅仅module_name和module_path需要手工配置 如:node node_modules/node-gyp/bin/node-gyp.js configure build --module_name=hello --module_path=../lib node node_modules/node-pre-gyp/bin/node-pre-gyp rebuild

问题:MacOS的都不需要依赖node,但Win都需要 因为Mac使用-undefined dynamic_lookup链接,在运行时才找符号 electron-v4.0-darwin-x64/hello.node: /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.4) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.200.5) node-v57-darwin-x64/hello.node: /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.4) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.200.5) electron-v4.0-win32-ia32\hello.node: c:\windows\system32\KERNEL32.DLL c:\program files\nodejs\NODE.EXE node-v64-win32-ia32\hello.node: c:\windows\system32\KERNEL32.DLL c:\program files\nodejs\NODE.EXE 差异在于依赖的node的版本,这在编译时设置 electron-v4.0-win32-ia32\hello.node "C:\Users\lbj\AppData\Local\node-gyp\Cache\5.0.8\ia32\node.lib" node-v64-win32-ia32\hello.node依赖: "C:\Users\lbj\AppData\Local\node-gyp\Cache\10.15.3\ia32\node.lib"

[detail] 实践上遇到:

  1. package.json的binary的module_name需与binding.gpy的target_name一样,否则错误,需加--verbose才能看到: Traceback (most recent call last): ... File "/Users/lbj/Documents/tools/node-v12.13.0-darwin-x64/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 1514, in RemoveLinkDependenciesFromNoneTargets if targets[t].get('variables', {}).get('link_dependency', 0): KeyError: 'binding.gyp:hello#target'

[mark] npm publish 发布如下文件, npm notice === Tarball Contents === npm notice 3.0kB hello.cc
npm notice 415B index.js
npm notice 802B package.json npm notice 3.5kB README.md
由于package.json#files配置了白名单,建议做法:配置黑名单,.npmignore,.gitignore,这项目没用到这点