我正在尝试在 Linux Mint 17.3 中从源代码构建 Atom,并且几乎已经完成构建过程。我正在关注这个教程:https://www.howtoing.com/atom-text-and-source-code-editor-for-linux/以及其他页面以获取错误帮助。
我刚刚运行了这个命令:sudo script/build --create-debian-package --install
。如果我在没有这两个选项的情况下运行命令,构建似乎工作正常,然后在输出的末尾,它建议添加这两个选项来安装软件。但是,使用这两个选项时,我收到以下错误:
Installing modules ✗
> [email protected] install /home/akaash/Git/atom/node_modules/github/node_modules/leveldown
> prebuild-install || node-gyp rebuild
prebuild-install WARN install EACCES: permission denied, mkdir '/home/akaash/Git/atom/node_modules/github/node_modules/leveldown/build'
gyp info it worked if it ends with ok
gyp verb cli [ '/home/akaash/Git/atom/apm/node_modules/atom-package-manager/bin/node',
gyp verb cli '/home/akaash/Git/atom/apm/node_modules/atom-package-manager/node_modules/.bin/node-gyp',
gyp verb cli 'rebuild' ]
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "/home/akaash/Git/atom/apm/node_modules/atom-package-manager/bin/python-interceptor.sh" in the PATH
gyp verb `which` succeeded /home/akaash/Git/atom/apm/node_modules/atom-package-manager/bin/python-interceptor.sh /home/akaash/Git/atom/apm/node_modules/atom-package-manager/bin/python-interceptor.sh
gyp verb check python version `/home/akaash/Git/atom/apm/node_modules/atom-package-manager/bin/python-interceptor.sh -c "import platform; print(platform.python_version());"` returned: "2.7.6\n"
gyp verb get node dir compiling against --target node version: 2.0.18
gyp verb command install [ '2.0.18' ]
gyp verb install input version string "2.0.18"
gyp verb install installing version: iojs-2.0.18
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: iojs-2.0.18
gyp verb build dir attempting to create "build" dir: /home/akaash/Git/atom/node_modules/github/node_modules/leveldown/build
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/akaash/Git/atom/node_modules/github/node_modules/leveldown/build'
gyp ERR! System Linux 3.19.0-32-generic
gyp ERR! command "/home/akaash/Git/atom/apm/node_modules/atom-package-manager/bin/node" "/home/akaash/Git/atom/apm/node_modules/atom-package-manager/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /home/akaash/Git/atom/node_modules/github/node_modules/leveldown
gyp ERR! node -v v8.9.3
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/akaash/.atom/.apm/_logs/2019-03-29T10_14_30_223Z-debug.log
child_process.js:630
throw err;
^
Error: Command failed: /home/akaash/Git/atom/apm/node_modules/atom-package-manager/bin/apm --loglevel=error install
at checkExecSyncError (child_process.js:607:13)
at Object.execFileSync (child_process.js:627:13)
at module.exports (/home/akaash/Git/atom/script/lib/run-apm-install.js:14:16)
at module.exports (/home/akaash/Git/atom/script/lib/transpile-packages-with-custom-transpiler-paths.js:30:7)
at Object.<anonymous> (/home/akaash/Git/atom/script/build:68:3)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
我查看了日志,该文件的末尾与上述输出末尾的 npm 错误相同。但我不确定其中大部分意味着什么。
我该如何解决这个问题并正确安装 Atom?
编辑:
我知道存在“权限被拒绝”错误,但我本以为可以通过使用 来修复该错误sudo
。但事实并非如此,所以我仍然试图弄清楚这一点。
答案1
我想我已经找到了这个问题的解决方案。在尝试了许多不同的修复方法但都不起作用后,我就跑sudo chown -R akaash:akaash ~/Git/atom
了script/build --create-debian-package --compress-artifacts --install --unsafe-perm=true --allow-root --global leveldown
。
我相信该chown
命令消除了使用sudo
.
一路上我发现了这个网站:
https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
这导致我:
https://github.com/creationix/nvm
其中解释了如何使用节点版本管理器而不是节点安装程序来更新 npm。
这可能有帮助,也可能没有帮助,尽管我知道它确实更新了 npm。但不知怎的,我尝试的所有方法的结合最终消除了这个错误。