Error: cannot find module "js-yaml" when starting "bower install"

I am going through the basic setup of an AngularJS application (just for starters), and I'm currently trying to install the Bower components for the application.

When I start bower installfrom the terminal, I get the following error:

Error: Cannot find module 'js-yaml'
    at Function.Module._resolveFilename (module.js:337:15)
    at Function.Module._load (module.js:287:25)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (Path\bower\node_modules\configstore\index.js:9:12)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)

I did not specify the module js-yamlanywhere in my scripts (as far as I know), so I'm not sure where this dependency comes from.

I tried to delete the node_modules folder by clearing the npm cache, including js-yamlin the file package.json, and then running the npm installation, but I get the same error on startupbower install

If it helps, my files bower.json, and package.jsonare shown below:

Bower.json

{
  "name": "starter-node-angular",
  "version": "1.0.0",
  "dependencies": {
    "bootstrap": "latest",
    "font-awesome": "latest",
    "animate.css": "latest",
    "angular": "latest",
    "angular-route": "latest"
  }
}

package.json

{
  "name": "starter-node-angular",
  "main": "server.js",
  "dependencies": {
    "express" : "~4.5.1",
    "mongoose" : "~3.8.0",
    "body-parser" : "~1.4.2",
    "method-override" : "~2.0.2",
    "js-yaml" : "latest"
  }
}

I am using WebStorm 10.0.4 (empty project as a starting point).

- , ?

+4
2

sudo npm install -g js-yaml .

+2

, , . :

$ npm uninstall bower

:

$ npm install -g bower

.

+1

Source: https://habr.com/ru/post/1617532/


All Articles