Joe Lewis
Joe Lewis

Reputation: 978

Issue with "npm install" after setting up AngularJS project with Yeoman

My issue appears after (or even during) the creation of the angular project with the command:

yo angular

during the process of installing all the devDependencies from the package.json ("npm install" which yo angular runs) I notice that some modules are missing in the node_modules folder.

So, I downloaded after that again with the "npm install name_of_the_module --save-dev" (so they will download and be included in the package.json in the devDependencies option).

But for example If I remove the node_modules folder and I execute the command npm install it will start the installation but will miss some modules, and sometimes the missing modules are different from the last run of npm install.

I don't know how to face this because I need to set up the project for the team and the first thing they will have to do is executing npm install & bower install (this last one works fine).

The content of package.json is:

{
  "name": "angular_test",
  "version": "0.0.0",
  "dependencies": {},
  "devDependencies": {
    "grunt": "^0.4.5",
    "grunt-autoprefixer": "^0.7.6",
    "grunt-concurrent": "^0.5.0",
    "grunt-contrib-clean": "^0.5.0",
    "grunt-contrib-concat": "^0.4.0",
    "grunt-contrib-connect": "^0.7.1",
    "grunt-contrib-copy": "^0.5.0",
    "grunt-contrib-cssmin": "^0.9.0",
    "grunt-contrib-htmlmin": "^0.3.0",
    "grunt-contrib-imagemin": "^0.8.1",
    "grunt-contrib-jshint": "^0.10.0",
    "grunt-contrib-uglify": "^0.4.1",
    "grunt-contrib-watch": "^0.6.1",
    "grunt-filerev": "^0.2.1",
    "grunt-google-cdn": "^0.4.0",
    "grunt-karma": "^0.9.0",
    "grunt-newer": "^0.7.0",
    "grunt-ng-annotate": "^0.3.2",
    "grunt-svgmin": "^0.4.0",
    "grunt-usemin": "^2.4.0",
    "grunt-wiredep": "^1.7.0",
    "imagemin-jpegtran": "^2.0.0",
    "imagemin-pngquant": "^2.0.0",
    "jshint-stylish": "^0.2.0",
    "karma": "^0.12.24",
    "karma-jasmine": "^0.1.5",
    "karma-phantomjs-launcher": "^0.1.4",
    "load-grunt-tasks": "^0.6.0",
    "time-grunt": "^0.3.2"
  },
  "engines": {
    "node": ">=0.10.0"
  },
  "scripts": {
    "test": "grunt test"
  }
}

and the errors or log I get after executing npm install is:

npm WARN optional dep failed, continuing [email protected]
npm WARN optional dep failed, continuing [email protected]
npm WARN optional dep failed, continuing [email protected]
npm WARN optional dep failed, continuing [email protected]
npm WARN optional dep failed, continuing [email protected]
npm ERR! EEXIST, open 'C:\Users\myself\AppData\Roaming\npm-cache\78af9c6a-m-cache-lodash-2-4-1-package-tgz.lock'
File exists: C:\Users\myself\AppData\Roaming\npm-cache\78af9c6a-m-cache-lodash-2-4-1-package-tgz.lock
Move it away, and try again.

npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! cwd C:\Users\myself\Documents\PHPStorm_Workspace\angular_test
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! path C:\Users\myself\AppData\Roaming\npm-cache\78af9c6a-m-cache-lodash-2-4-1-package-tgz.lock
npm ERR! code EEXIST
npm ERR! errno 47
npm ERR! not ok code 0

UPDATE

All these issues appear because of "npm" so after researching a little bit, the creator of npm suggested to download the last version, which is only available either...

npm install -g npm@next

or

npm install -g [email protected] (in this case is only for the current release 2.1.2, which is the latest release)

or

When I find the github discussion I will update the post with it.

Upvotes: 4

Views: 2826

Answers (3)

Alan
Alan

Reputation: 634

This is bug and can be fixed by update your npm version (https://github.com/npm/npm/issues/6318). Try: npm -g install npm@next

Upvotes: 2

Cedric Meury
Cedric Meury

Reputation: 963

Most likely due to this bug in npm.

Upvotes: 1

pedrommuller
pedrommuller

Reputation: 16056

File exists: C:\Users\myself\AppData\Roaming\npm-cache\78af9c6a-m-cache-lodash-2-4-1-package-tgz.lock Move it away, and try again.

It seems like npm is resolvng from your cache, try # npm cache clear (for more info) to make sure a package isn’t loading anything from npm’s cache.

Upvotes: 1

Related Questions