apm upgrade: Failed to change folder ownership under npm cache

If you meet errors similar to the following one while upgrading [apm] packages via command line:

npm ERR! Failed to change folder ownership under npm cache for %s /Users/Chris/.atom/.node-gyp/.atom/.apm/_git-remotes/https-github-com-Glavin001-Coffee-Formatter-git-41cd2663
npm ERR! Error: ENOENT, readdir '/Users/Chris/.atom/.node-gyp/.atom/.apm/_git-remotes/https-github-com-Glavin001-Coffee-Formatter-git-41cd2663/description'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

Its mostly just because of there are not just one versions of node-gyp under ~/.atom/.node-gyp.

In my case, there were 3 versions:

ls ~/.atom/.node-gyp/.node-gyp
0.11.10 0.11.13 0.17.0

The way to fix this issue is very simple, just run the following command to force [Atom] to recreate .node-gyp folder:

rm -dr ~/.atom/.node-gyp

Now, apm upgrade works again.

[Atom]: https://atom.io/
[apm]: https://github.com/atom/apm

 
16
Kudos
 
16
Kudos

Now read this

Node.js 101: Promise and async

先回顾一下 Sagase 的项目结构: lib/ cli.js sagase.js Gruntfile.js package.json 上一篇讲了 package.json,这一篇讲 lib/sagase.js。 因为代码比较长,就分开一节节地讲,完整的点开 GitHub 看吧。 'use strict'; 通知编译器进入 strict mode,主要的作用是让编译器帮你检查一些坑,有经验的 JavaScript 开发者可以忽略。 var fs =... Continue →