Bower 安装:未知编码

bower install: unknown encoding

我有一个 ec2 实例,我正在尝试 bower install 我的依赖项。在本地一切正常,虽然 bower install 在本地项目上工作,但我得到

Error: Unknown encoding
at Buffer.write (buffer.js:382:13)
at new Buffer (buffer.js:261:26)
at Object.fs.writeFileSync (evalmachine.<anonymous>:758:12)
at Object.create.all.set (/usr/local/lib/node_modules/bower/node_modules/configstore/index.js:64:8)
at Object.Configstore (/usr/local/lib/node_modules/bower/node_modules/configstore/index.js:27:11)
at readCachedConfig (/usr/local/lib/node_modules/bower/lib/config.js:22:23)
at defaultConfig (/usr/local/lib/node_modules/bower/lib/config.js:11:24)
at Object.<anonymous> (/usr/local/lib/node_modules/bower/lib/index.js:40:32)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)

尝试在 ec2 实例上 运行 时。 bower.json 文件看起来很典型:

{
  "name": "package",
  "version": "0.0.1",
  "homepage": "#",
  "description": "my package",
  "main": "src/index.html",
  "moduleType": [
    "globals",
    "node"
  ],
  "keywords": [
    "none"
  ],
  "authors": [
    "nikk wong"
  ],
  "license": "MIT",
  "ignore": [
    "**/.*",
    "node_modules",
    "bower_components",
    "test",
    "tests"
  ],
  "dependencies": {
    "angular-bootstrap-colorpicker": "~3.0.14",
    "angular-material": "~0.10.0",
    "angular-ui-router": "~0.2.14",
    "angular-animate": "~1.3.15",
    "angular-aria": "~1.3.15",
    "angular": "~1.3.15",
    "angular-base64-upload": "~0.1.11",
    "ng-file-upload": "~5.0.6",
    "material-design-icons": "~2.0.0"
  },
  "devDependencies": {
    "ui-router-extras": "~0.0.13"
  }
}

事实上,根本没有 bower 命令起作用。 运行ning bower returns 同样的错误。我 运行宁 npm 3.1.2。有没有人遇到过这个?

谢谢。

已通过将 node 更新到最新版本来修复。

sudo npm cache clean -f
sudo npm install -g n
sudo n stable