【问题标题】:Building older version of Atom text editor from source?从源代码构建旧版本的 Atom 文本编辑器?
【发布时间】:2017-04-23 18:04:02
【问题描述】:

我从 git(来自https://github.com/atom/atom)获得了 Atom,并在不久前检查了 1.5.0-beta0 版本,当时我用它构建了一个 32 位的 deb;我在 Ubuntu 14.04 上。

现在,我想构建与 64 位 deb 完全相同的版本。我以为会很直接,所以就在git源码文件夹下发了:

script/build
script/grunt mkdeb

这为我构建了一个/tmp/atom-build/atom-1.5.0-beta0-amd64.deb,但当我安装它时,它告诉我:

/usr/share/atom/atom: error while loading shared libraries: libnotify.so.4: cannot open shared object file: No such file or directory

...这很奇怪,因为在我的 64 位系统上:

$ locate libnotify.so.4
/usr/lib/x86_64-linux-gnu/libnotify.so.4
/usr/lib/x86_64-linux-gnu/libnotify.so.4.0.0

我想,这不可能,atom 的构建系统无法区分 32 位和 64 位构建?但结果确实如此,因为我尝试了LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu atom,它给了我一些错误(编辑:很可能是:“/usr/share/atom/atom: error while loading shared libraries: libnotify.so.4: wrong ELF class: ELFCLASS64”),这表明它可能确实有这个问题......

太好了。好的,现在我先尝试清洁:

script/clean
script/build

现在,当我在这里通过无线网络进行构建时,npm(或apm)会完全阻塞我的互联网连接,最终产生如下消息:

....
Installing build modules...
npm ERR! fetch failed https://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz
npm ERR! fetch failed https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.5.0.tgz
....

此时,如果我尝试在 Firefox 中加载页面,那么它将一直在旋转,并且永远不会加载页面。

于是,我从无线改成了有线,终于搞定了:

atom_git$ script/clean
atom_git$ script/build
Node: v4.0.0
npm: v2.14.2
Installing build modules...
=> Took 94239ms.

Installing apm...
=> Took 67760ms.

Deleting old packages...
=> Took 418ms.

Installing modules ✓
Installing atom-dark-syntax@0.27.0 ✓
Installing atom-dark-ui@0.51.0 ✓
Installing atom-light-syntax@0.28.0 ✓
Installing atom-light-ui@0.43.0 ✓
Installing base16-tomorrow-dark-theme@1.1.0 ✓
Installing base16-tomorrow-light-theme@1.1.1 ✓
Installing one-dark-ui@1.1.9 ✓
Installing one-light-ui@1.1.9 ✓
Installing one-dark-syntax@1.1.2 ✓
Installing one-light-syntax@1.1.2 ✓
Installing solarized-dark-syntax@0.39.0 ✓
Installing solarized-light-syntax@0.23.0 ✓
Installing about@1.3.0 ✓
Installing archive-view@0.61.0 ✓
Installing autocomplete-atom-api@0.9.2 ✓
Installing autocomplete-css@0.11.0 ✓
Installing autocomplete-html@0.7.2 ✓
Installing autocomplete-plus@2.25.0 ✓
Installing autocomplete-snippets@1.9.0 ✓
Installing autoflow@0.26.0 ✓
Installing autosave@0.23.0 ✓
Installing background-tips@0.26.0 ✓
Installing bookmarks@0.38.0 ✓
Installing bracket-matcher@0.79.0 ✓
Installing command-palette@0.38.0 ✓
Installing deprecation-cop@0.54.0 ✓
Installing dev-live-reload@0.47.0 ✓
Installing encoding-selector@0.21.0 ✓
Installing exception-reporting@0.37.0 ✓
Installing find-and-replace@0.195.0 ✓
Installing fuzzy-finder@0.94.0 ✓
Installing git-diff@0.57.0 ✓
Installing go-to-line@0.30.0 ✓
Installing grammar-selector@0.48.0 ✓
Installing image-view@0.56.0 ✓
Installing incompatible-packages@0.25.0 ✓
Installing keybinding-resolver@0.33.0 ✓
Installing line-ending-selector@0.3.0 ✓
Installing link@0.31.0 ✓
Installing markdown-preview@0.157.1 ✓
Installing metrics@0.53.1 ✓
Installing notifications@0.62.1 ✓
Installing open-on-github@0.40.0 ✓
Installing package-generator@0.41.0 ✓
Installing settings-view@0.232.3 ✓
Installing snippets@1.0.1 ✓
Installing spell-check@0.65.0 ✓
Installing status-bar@0.80.0 ✓
Installing styleguide@0.45.0 ✓
Installing symbols-view@0.110.1 ✓
Installing tabs@0.88.0 ✗
Package version: 0.88.0 not found

... 现在这里的构建过程停止了。我想该死的 - 我怎么能从源代码构建,现在他们依赖于互联网上不断被删除的包?但后来我浏览了一下,发现https://github.com/atom/tabs/releases/tag/v0.88.0 - 很好;所以我尝试了这个:

cd /tmp
wget https://github.com/atom/tabs/archive/v0.88.0.zip
unzip v0.88.0.zip

cd /path/to/atom_git
mv /tmp/tabs-0.88.0 ./node_modules/

...并再次尝试构建:

atom_git$ script/build
Node: v4.0.0
npm: v2.13.3
Installing build modules...
=> Took 3473ms.

Installing apm...
=> Took 1122ms.

Deleting old packages...
Removing tabs-0.88.0 ✓
=> Took 1290ms.

Installing modules ✓
Installing tabs@0.88.0 ✗
Package version: 0.88.0 not found

该死的——它找到了 tabs@0.88.0,然后把它删除了!!我如何说服现在的构建过程,不要在网上寻找tabs@0.88.0,而是使用我提供给它的那个,以便构建脚本可以继续构建?

【问题讨论】:

    标签: node.js linux


    【解决方案1】:

    好吧,我想我到了某个地方;

    第一个问题是,当我解压v0.88.0.zip 时,如上面的sn-p 所示,我得到一个名为tabs-0.88.0 的目录,我直接将其移动到atom_git/node_modules/。但是,./script/bootstrap 告诉我们“删除旧包...”是由于apm clean,如果我们调用帮助:

    atom_git$ ./apm/node_modules/atom-package-manager/bin/apm clean --help
    Usage: apm clean
    Deletes all packages in the node_modules folder that are not referenced
    as a dependency in the package.json file.
    

    啊 - 我的 atom 源的 package.json 包含:

    atom_git$ grep tabs package.json 
        "tabs": "0.88.0",
    

    因此,它希望文件夹命名为tabs - 而不是tabs-0.88.0;所以正确的做法是:

    cd /tmp
    wget https://github.com/atom/tabs/archive/v0.88.0.zip
    unzip v0.88.0.zip
    
    cd /path/to/atom_git
    mv /tmp/tabs-0.88.0 ./node_modules/tabs
    

    然后我遇到了与tree-view 相同的问题;所以我做到了

    cd /tmp
    wget https://github.com/atom/tree-view/archive/v0.198.1.zip
    unzip v0.198.1.zip
    
    cd /path/to/atom_git
    mv /tmp/tree-view-0.198.1 ./node_modules/tree-view
    

    这使得构建继续直到:

    Running "compile-packages-slug" task
    >> tabs: No README data
    Warning: Task "compile-packages-slug" failed. Use --force to continue.
    

    解决方案是:NPM - How to fix "No readme data"——事实证明,现在 package.json 的插件必须包含 readme 键,所以我在 atom_git/node_modules/tabs/package.json 中添加了类似的内容:

    ...
      "dependencies": {
        "temp": "~0.8.1",
        "underscore-plus": "1.x"
      },
      "readme": "# Tabs package",
      "readmeFilename": "README.md",
      "devDependencies": {
    ...
    

    ... 和 tree-view 一样 - 最后构建完成,script/grunt mkdeb 工作,创建了一个 64 位 deb;这个 deb 是可安装的——atom 终于为我运行了(它在第一次启动时仍然吐出一个错误,我没有记录(编辑:它可能是“Uncaught TypeError: Cannot read property 'length' of undefined”)——但第二次启动了不会导致任何错误,所以我想现在可以了)...

    编辑:不,这不行,每次我键入一个键时它都会给我Uncaught TypeError: Cannot read property 'length' of undefined...

    这是多么浪费时间......

    【讨论】:

      猜你喜欢
      • 2017-09-21
      • 1970-01-01
      • 2021-10-21
      • 1970-01-01
      • 1970-01-01
      • 2022-10-23
      • 2018-03-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多