Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Cannot find module 'js-yaml' when running "bower install"

I am walking through basic set up of an AngularJS application (Just getting started) and am currently trying to install Bower components for the application.

When I run bower install from 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 haven’t specified js-yaml module anywhere in my scripts (as far as I am aware), so not sure where this dependency is coming from.

I have tried deleting the node_modules folder, clearing the npm cache, including js-yaml within the package.json file then re-running npm install, but I get the same error when running bower install

If it helps, my bower.json and package.json files are 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 the starting point).

Has anyone come across this or a similar issue and possible point me in the right direction on how to resolve the issue?

like image 687
ricky89 Avatar asked Feb 08 '23 11:02

ricky89


1 Answers

Running sudo npm install -g js-yaml first should get you in the right direction.

like image 193
WKFY Avatar answered Feb 12 '23 09:02

WKFY