[npm & Bower] npm を動かしたら Error: Cannot find module ‘internal/fs’ の対処

謎のエラーは Node v7 にした影響でした。

[markdown]
“`prettyprinted
% $(npm bin)/sassdoc -v
module.js:472
throw err;
^
Error: Cannot find module ‘internal/fs’
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at evalmachine.:17:20
at Object. (/Users/****/projects/****/node_modules/vinyl-fs/node_modules/graceful-fs/fs.js:11:1)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
“`

こちらでした。

> * [Error: Cannot find module ‘internal/fs’ · Issue #9658 · nodejs/node](https://github.com/nodejs/node/issues/9658)

“The release notes below are annotated with the main breaking changes.” だそうで。

> * [Node v7.0.0 (Current) | Node.js](https://nodejs.org/en/blog/release/v7.0.0/)
>
> The release notes below are annotated with the main breaking changes. Note that because this new version of Node.js is shipping with a new version of V8, existing native addons will need to be recompiled or runtime errors will occur when trying to load them. Use npm rebuild or simply remove your node_modules and npm install from scratch.

なるほど。指示通りに対応します。

“`prettyprinted
% node -v
v7.2.0
“`

プロジェクトディレクトリの node_modules/ を削除して、再インストール。

“`prettyprinted
% rm -rf node_modules/
% npm install
“`

解決しました。
[/markdown]