Search code examples
node.jsamazon-ec2bowerbower-install

bower install: unknown encoding


I have an ec2 instance where I'm attempting to bower install my dependencies. Everything is working fine locally, and though bower install works on the local project, I get

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)

When trying to run it on the ec2 instance. The bower.json file looks fairly typical:

{
  "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"
  }
}

In fact, no bower commands work at all. running bower returns the same error. I'm running npm 3.1.2. Has anyone encountered this?

Thanks.


Solution

  • fixed by updating node to the lastest version.

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