1

Background

I have package.json with a bunch of development dependencies.
I use local install i.e. npm install with my package.json

node -v v0.10.26
npm -v 1.4.4
Windows 7 x32bit

Problem

On fresh first try with no ./node_modules present (i.e. fresh) I get various errors. Some of them are related to npm_cache and locks saying that I need to run as Administrator. Why?
Why does the subsequent npm install succeeds.

Questions

  • Why should subsequent install should succeed ? I am not interested why they fail - there could be various reasons and perhaps each need to be dealt with well.

  • Can deleting local ./node_modules folder manually cause any issues that are relate to this topic ?

Updates: Added following sections as requested

Logs/References

package.json

{
  "name": "XXXXX-XXXX-XXXX",
  "version": "0.0.2",
  "dependencies": {
    "angular": "1.3.0-beta.14",
    "ng-grid": "2.0.11",
    "json3": "~3.2.6",
    "es5-shim": "~2.1.0",
    "jquery": "~1.10.2",
    "bootstrap": "~3.0.3",
    "angular-resource": "1.3.0-beta.14",
    "angular-route": "1.3.0-beta.14",
    "angular-bootstrap": "~0.11.0",
    "jquery-ui": "~1.10.4",
    "angular-animate": "1.3.0-beta.14",
    "tinymce": "~4.1.2",
    "angular-ui-tinymce": "~0.0.5"
  },
  "devDependencies": {
    "angular-mocks": "1.3.0-beta.14",
    "angular-scenario": "1.3.0-beta.14"
  },
  "resolutions": {
    "angular": "1.3.0-beta.14",
    "tinymce": "~4.1.2",
    "angular-mocks": "1.3.0-beta.14",
    "angular-scenario": "1.3.0-beta.14"
  }
}

npm install output snippet

npm ERR! error rolling back Error: EPERM, unlink 'C:\Users\REPLACED_PATH\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-pngquant\node_modules\pngquant-bin\node_modules\bin-build\node_modules\download\node_modules\download-status\node_modu
    les\lpad-align\node_modules\max-component\node_modules\to-function\node_modules\remove-try-require\node_modules\ast-transform\node_modules\escodegen\escodegen.bro
    wser.min.js'
    npm ERR! error rolling back  download@3.1.0 { [Error: EPERM, unlink 'C:\Users\REPLACED_PATH\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-pngquant\node_modules\pngquant-bin\node_modules\bin-build\node_modules\download\node_modules\downlo
    ad-status\node_modules\lpad-align\node_modules\max-component\node_modules\to-function\node_modules\remove-try-require\node_modules\ast-transform\node_modules\esco
    degen\escodegen.browser.min.js']
    npm ERR! error rolling back   errno: 50,
    npm ERR! error rolling back   code: 'EPERM',
    npm ERR! error rolling back   path: 'C:\\Users\\my.userid\\Documents\\clients\\merge.0.0.1\\tps-clients\\tps-web-app\\node_modules\\grunt-contrib-imagemin\\nod
    e_modules\\imagemin\\node_modules\\imagemin-pngquant\\node_modules\\pngquant-bin\\node_modules\\bin-build\\node_modules\\download\\node_modules\\download-status\\
    node_modules\\lpad-align\\node_modules\\max-component\\node_modules\\to-function\\node_modules\\remove-try-require\\node_modules\\ast-transform\\node_modules\\esc
    odegen\\escodegen.browser.min.js' }
    npm http 200 https://registry.npmjs.org/ast-types
    npm http GET https://registry.npmjs.org/source-map/0.1.32
    npm http 304 https://registry.npmjs.org/source-map/0.1.32
    npm http GET https://registry.npmjs.org/estraverse
    npm http GET https://registry.npmjs.org/is-relative
    npm http GET https://registry.npmjs.org/wrappy
    npm http 304 https://registry.npmjs.org/estraverse
    npm http 304 https://registry.npmjs.org/is-relative
    npm http 304 https://registry.npmjs.org/wrappy
    npm http GET https://registry.npmjs.org/ast-types/-/ast-types-0.3.38.tgz
    npm http GET https://registry.npmjs.org/cls/-/cls-0.1.5.tgz
    npm http GET https://registry.npmjs.org/private/-/private-0.1.5.tgz
    npm ERR! Error: ENOENT, lstat 'C:\Users\REPLACED_PATH\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-pngquant\node_modules\pngquant-bin\node_modules\bin-build\node_modules\download\node_modules\request\node_modules\http-signature\node_mod
    ules\asn1'
    npm ERR! If you need help, you may report this *entire* log,
    npm ERR! including the npm and node versions, at:
    npm ERR!     <http://github.com/npm/npm/issues>
    npm ERR! System Windows_NT 6.1.7601
    npm ERR! command "C:\\My_Data\\devenv\\node\\\\node.exe" "C:\\My_Data\\devenv\\node\\node_modules\\npm\\bin\\npm-cli.js" "install"
    npm ERR! cwd C:\Users\REPLACED_PATH
    npm ERR! node -v v0.10.26
    npm ERR! npm -v 1.4.4
    npm ERR! path C:\Users\REPLACED_PATH\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-pngquant\node_modules\pngquant-bin\node_modules\bin-build\node_modules\download\node_modules\request\node_modules\http-signature\node_modules\asn1
    npm ERR! fstream_path C:\Users\REPLACED_PATH\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-pngquant\node_modules\pngquant-bin\node_modules\bin-build\node_modules\download\node_modules\request\node_modules\http-signature\node_modules\asn1

    npm ERR! fstream_unc_path \\?\C:\Users\REPLACED_PATH\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-pngquant\node_modules\pngquant-bin\node_modules\bin-build\node_modules\download\node_modules\request\node_modules\http-signature\node_modu
    les\asn1
    npm ERR! fstream_type Directory
    npm ERR! fstream_class DirWriter
    npm ERR! code ENOENT
    npm ERR! errno 34
bhantol
  • 9,368
  • 7
  • 44
  • 81
  • Can you post both your package.json and the output of `npm install`? – Scimonster Oct 21 '14 at 17:08
  • 2
    Seems npm isn't being run as an administrative user, and cannot write to its cache directory (possibly) – Julian H. Lam Oct 21 '14 at 22:46
  • I am running this under my home dir. The REPLACE_PATH was actually m home directory that I just masked for posting it here. In any case it does not explain why it succeeds next time. The next npm install command is issued in the same windows command shell. Few seconds after the failure. – bhantol Oct 22 '14 at 02:49

1 Answers1

0

As commented by @Julian H. Lam the problem was the way Windows 7 OS treats the files and the folder permissions.

After running the cmd as Administrator I am no longer seeing this.

bhantol
  • 9,368
  • 7
  • 44
  • 81