node.js - apm(atom的包管理器)启动shell运行错误

标签 node.js bash shell electron atom-editor

我正在处理我的 osx 10.11 系统中的 apm 错误。当我运行时

apm

在我的命令行中,由于文件路径错误而引发错误:

/usr/local/bin/apm: line 32: /Applications/Atom.app/Contents/Resources/app/apm/node_modules/.bin/node: No such file or directory

检查后发现: 在apm shell(/Atom.app/Contents/Resources/app/apm/node_modules/.bin/apm)中,有一个while循环:

while [ -L "$binDir" ]
do
  binDir=`readlink "$binDir"`
  builtin cd "`dirname "$binDir"`"
  binDir=`basename "$binDir"`
done

看起来这个循环在我的 osx 系统上只运行一次,而在其他系统上运行两次,我遇到的错误就是因为这个。

最佳答案

-L 检查文件是否是符号链接(symbolic link),如果是则返回 True。来自人测试:

   -L FILE
          FILE exists and is a symbolic link (same as -h)

查看一个示例,其中我们创建了一个文件 hello 和一个名为 my_link 的(软)链接:

$ touch hello
$ ln -s hello my_link
$ [ -L "hello" ] && echo "this is a link" || echo "this is NOT a link"
this is NOT a link
$ [ -L "my_link" ] && echo "this is a link" || echo "this is NOT a link"
this is a link

关于node.js - apm(atom的包管理器)启动shell运行错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37656091/

相关文章:

Linux AWK - 拆分文件时自定义文件名

linux - 备份 MySQL 数据库的 Bash 脚本

linux - 计算目录中包含的文件

c# - Shell 脚本与高级解释语言(C#/Java/等)的性能比较

perl - Perl脚本-从管道ssh shell 将STDOUT打印到文件中

javascript - 如何在 NodeJS Express 路由器 res.render 中传递 Mongoose 返回变量?

javascript - 如何更新嵌套的 mongo 对象

node.js - MongoError : attempt to write outside buffer bounds

javascript - 在同一 JavaScript 函数中重复使用变量的场景 : Always a No No?

c++ - 有没有办法在后台发送一些已知 pid 的进程?