Error with npm install on v3.0.0 on windows #8701

Closed
Surreal9 opened this Issue Jun 26, 2015 · 9 comments

Projects

None yet

4 participants

@Surreal9

I am looking forward to npm@3 as I have just run into the notorious 'nested node_modules lead to paths being too long on Windows' issue. I am currently trying this on a Win 8 install.

Running npm install seems to succeed in downloading the various modules and sub-modules of each module, and npm install --log-level silly shows an 'idealTree' that looks reasonable, however it ends up erroring out with what seems like a permissions issue. Specifically it reads: npm ERR! Error: EACCES, access 'C:\Users\john.arnold\AppData\Roaming\npm\node_modules\npm\node_modules'

This is odd because I have gone into that folder and added full permissions to 'Everyone'. I have also tried running this through an administrator console with the same results.

Here is the specific output:
(cutting out a lot of npm sill idealTree lines, and the initial adding of packages to the npm-cache)

npm sill idealTree ├── xtend@4.0.0
npm sill idealTree └── yargs@3.13.0
npm sill generateActionsToTake Starting
npm sill install generateActionsToTake
npm WARN checkPermissions Missing write access to C:\Users\john.arnold\AppData\Roaming\npm\node_modules\npm\node_modules
npm sill rollbackFailedOptional Starting
npm sill rollbackFailedOptional Finishing
npm sill runTopLevelLifecycles Starting
npm sill runTopLevelLifecycles Finishing
npm sill install printInstalled
npm@3.0.0 C:\Users\john.arnold\AppData\Roaming\npm\node_modules\npm
├── deep-equal@1.0.0
├── marked@0.3.3
├── marked-man@0.1.4
├─┬ nock@2.6.0
│ ├─┬ chai@2.3.0
│ │ ├── assertion-error@1.0.0
│ │ └─┬ deep-eql@0.1.3
│ │   └── type-detect@0.1.1
│ ├─┬ debug@1.0.4
│ │ └── ms@0.6.2
│ ├── lodash@2.4.1
│ └── propagate@0.3.1
├─┬ npm-registry-couchapp@2.6.11
│ ├─┬ couchapp@0.11.0
│ │ ├── coffee-script@1.9.3
│ │ ├─┬ connect@3.4.0
│ │ │ ├─┬ finalhandler@0.4.0
│ │ │ │ ├── escape-html@1.0.2
│ │ │ │ ├─┬ on-finished@2.3.0
│ │ │ │ │ └── ee-first@1.1.1
│ │ │ │ └── unpipe@1.0.0
│ │ │ ├── parseurl@1.3.0
│ │ │ └── utils-merge@1.0.0
│ │ ├─┬ http-proxy@0.8.7
│ │ │ ├── colors@0.6.2
│ │ │ ├── optimist@0.3.7
│ │ │ └── pkginfo@0.2.3
│ │ ├─┬ nano@6.1.3
│ │ │ ├── errs@0.3.2
│ │ │ ├─┬ follow@0.11.4
│ │ │ │ ├── browser-request@0.3.3
│ │ │ │ └── debug@0.7.4
│ │ │ └── underscore@1.8.3
│ │ ├─┬ url@0.10.3
│ │ │ ├── punycode@1.3.2
│ │ │ └── querystring@0.2.0
│ │ └── watch@0.8.0
│ └── json@9.0.3
├─┬ npm-registry-mock@1.0.1
│ └─┬ hock@0.2.5
│   └── deep-equal@0.2.1
├── require-inject@1.2.0
├── sprintf-js@1.0.2
├─┬ standard@4.3.3
│ ├─┬ eslint@0.23.0
│ │ ├─┬ doctrine@0.6.4
│ │ │ └── esutils@1.1.6
│ │ ├─┬ escope@3.1.0
│ │ │ ├─┬ es6-map@0.1.1
│ │ │ │ ├── d@0.1.1
│ │ │ │ ├─┬ es5-ext@0.10.7
│ │ │ │ │ └── es6-symbol@2.0.1
│ │ │ │ ├─┬ es6-iterator@0.1.3
│ │ │ │ │ └── es6-symbol@2.0.1
│ │ │ │ ├── es6-set@0.1.1
│ │ │ │ ├── es6-symbol@0.1.1
│ │ │ │ └── event-emitter@0.3.3
│ │ │ ├─┬ es6-weak-map@0.1.4
│ │ │ │ └── es6-symbol@2.0.1
│ │ │ ├─┬ esrecurse@3.1.1
│ │ │ │ └── estraverse@3.1.0
│ │ │ └── estraverse@3.1.0
│ │ ├── espree@2.0.3
│ │ ├── estraverse@2.0.0
│ │ ├── estraverse-fb@1.3.1
│ │ ├── globals@8.1.0
│ │ ├─┬ inquirer@0.8.5
│ │ │ ├── cli-width@1.0.1
│ │ │ ├── figures@1.3.5
│ │ │ ├── lodash@3.9.3
│ │ │ ├─┬ readline2@0.1.1
│ │ │ │ └── mute-stream@0.0.4
│ │ │ ├── rx@2.5.3
│ │ │ └── through@2.3.7
│ │ ├── object-assign@2.1.1
│ │ ├─┬ optionator@0.5.0
│ │ │ ├── deep-is@0.1.3
│ │ │ ├── fast-levenshtein@1.0.6
│ │ │ ├── levn@0.2.5
│ │ │ ├── prelude-ls@1.1.2
│ │ │ ├── type-check@0.3.1
│ │ │ └── wordwrap@0.0.3
│ │ ├── strip-json-comments@1.0.2
│ │ ├── user-home@1.1.1
│ │ └── xml-escape@1.0.0
│ ├── eslint-config-standard@3.3.0
│ ├── eslint-config-standard-react@1.0.0
│ ├── eslint-plugin-react@2.5.2
│ ├── find-root@0.1.1
│ ├── ignore@2.2.15
│ ├── minimist@1.1.1
│ ├── pkg-config@1.0.1
│ ├── run-parallel@1.1.2
│ ├─┬ standard-format@1.3.9
│ │ ├─┬ esformatter@0.7.0
│ │ │ ├── debug@0.7.4
│ │ │ ├── disparity@2.0.0
│ │ │ ├── espree@1.12.3
│ │ │ ├── minimist@1.1.1
│ │ │ ├── mout@0.11.0
│ │ │ ├─┬ npm-run@1.1.1
│ │ │ │ ├── minimist@1.1.1
│ │ │ │ ├── npm-path@1.0.2
│ │ │ │ ├─┬ serializerr@1.0.1
│ │ │ │ │ └── protochain@1.0.2
│ │ │ │ └── sync-exec@0.5.0
│ │ │ ├── resolve@1.1.6
│ │ │ ├─┬ rocambole@0.6.0
│ │ │ │ └── esprima@2.4.0
│ │ │ ├── rocambole-indent@2.0.4
│ │ │ ├── rocambole-linebreak@1.0.1
│ │ │ ├── rocambole-node@1.0.0
│ │ │ ├── rocambole-token@1.2.1
│ │ │ ├─┬ rocambole-whitespace@1.0.0
│ │ │ │ └── repeat-string@1.5.2
│ │ │ ├── semver@2.2.1
│ │ │ └── strip-json-comments@0.1.3
│ │ ├─┬ esformatter-eol-last@1.0.0
│ │ │ └── string.prototype.endswith@0.2.0
│ │ ├─┬ esformatter-literal-notation@1.0.1
│ │ │ └─┬ rocambole@0.3.6
│ │ │   └── esprima@1.0.4
│ │ ├── esformatter-quotes@1.0.2
│ │ ├── esformatter-semicolon-first@1.0.1
│ │ ├── esformatter-spaced-lined-comment@2.0.1
│ │ ├── minimist@1.1.1
│ │ └── stdin@0.0.1
│ └── uniq@1.0.1
└─┬ tap@1.2.1
  ├── buffer-equal@0.0.1
  ├─┬ coveralls@2.11.2
  │ ├─┬ js-yaml@3.0.1
  │ │ ├─┬ argparse@0.1.16
  │ │ │ ├── underscore@1.7.0
  │ │ │ └── underscore.string@2.4.0
  │ │ └── esprima@1.0.4
  │ ├── lcov-parse@0.0.6
  │ ├── log-driver@1.2.4
  │ └─┬ request@2.40.0
  │   ├── forever-agent@0.5.2
  │   ├─┬ form-data@0.1.4
  │   │ ├── async@0.9.2
  │   │ ├─┬ combined-stream@0.0.7
  │   │ │ └── delayed-stream@0.0.5
  │   │ └── mime@1.2.11
  │   ├─┬ hawk@1.1.1
  │   │ ├── boom@0.4.2
  │   │ ├── cryptiles@0.2.2
  │   │ ├── hoek@0.9.1
  │   │ └── sntp@0.2.4
  │   ├── http-signature@0.10.1
  │   ├── mime-types@1.0.2
  │   ├── oauth-sign@0.3.0
  │   └── qs@1.0.2
  ├── foreground-child@1.2.0
  ├─┬ js-yaml@3.3.1
  │ ├─┬ argparse@1.0.2
  │ │ └── lodash@3.9.3
  │ └── esprima@2.2.0
  ├─┬ nyc@2.4.0
  │ ├─┬ istanbul@0.3.16
  │ │ ├─┬ escodegen@1.6.1
  │ │ │ ├── esprima@1.2.5
  │ │ │ ├── estraverse@1.9.3
  │ │ │ └─┬ source-map@0.1.43
  │ │ │   └── amdefine@0.1.1
  │ │ ├── esprima@2.1.0
  │ │ ├── fileset@0.2.1
  │ │ ├─┬ handlebars@3.0.0
  │ │ │ ├── optimist@0.6.1
  │ │ │ └─┬ uglify-js@2.3.6
  │ │ │   └── async@0.2.10
  │ │ └── which@1.0.9
  │ ├── lodash@3.9.3
  │ ├── spawn-wrap@1.0.1
  │ ├─┬ strip-bom@1.0.0
  │ │ ├── first-chunk-stream@1.0.0
  │ │ └── is-utf8@0.2.0
  │ └─┬ yargs@3.13.0
  │   ├── camelcase@1.1.0
  │   ├─┬ cliui@2.1.0
  │   │ ├─┬ center-align@0.1.1
  │   │ │ └─┬ align-text@0.1.3
  │   │ │   ├── kind-of@2.0.0
  │   │ │   └── longest@1.0.1
  │   │ ├── right-align@0.1.3
  │   │ └── wordwrap@0.0.2
  │   ├── decamelize@1.0.0
  │   └── window-size@0.1.1
  ├── signal-exit@2.1.2
  ├─┬ tap-mocha-reporter@0.0.15
  │ └── diff@1.4.0
  └─┬ tap-parser@1.1.6
    └── events-to-array@1.0.2

npm verb stack Error: EACCES, access 'C:\Users\john.arnold\AppData\Roaming\npm\node_modules\npm\node_modules'
npm verb stack     at accessError (C:\Users\john.arnold\AppData\Roaming\npm\node_modules\npm\lib\install\check-permissions.js:88:18)
npm verb stack     at C:\Users\john.arnold\AppData\Roaming\npm\node_modules\npm\lib\install\check-permissions.js:79:29
npm verb stack     at OpenReq.Req.done (C:\Users\john.arnold\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:141:5)
npm verb stack     at OpenReq.done (C:\Users\john.arnold\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:61:22)
npm verb stack     at Object.oncomplete (evalmachine.<anonymous>:107:15)
npm verb cwd C:\Users\john.arnold\AppData\Roaming\npm\node_modules\npm
npm ERR! Windows_NT 6.2.9200
npm ERR! argv "node" "C:\\Users\\john.arnold\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "--loglevel" "silly"
npm ERR! node v0.10.31
npm ERR! npm  v3.0.0
npm ERR! path C:\Users\john.arnold\AppData\Roaming\npm\node_modules\npm\node_modules
npm ERR! code EACCES

npm ERR! Error: EACCES, access 'C:\Users\john.arnold\AppData\Roaming\npm\node_modules\npm\node_modules'
npm ERR!     at accessError (C:\Users\john.arnold\AppData\Roaming\npm\node_modules\npm\lib\install\check-permissions.js:88:18)
npm ERR!     at C:\Users\john.arnold\AppData\Roaming\npm\node_modules\npm\lib\install\check-permissions.js:79:29
npm ERR!     at OpenReq.Req.done (C:\Users\john.arnold\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:141:5)
npm ERR!     at OpenReq.done (C:\Users\john.arnold\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:61:22)
npm ERR!     at Object.oncomplete (evalmachine.<anonymous>:107:15)
npm ERR!  { [Error: EACCES, access 'C:\Users\john.arnold\AppData\Roaming\npm\node_modules\npm\node_modules']
npm ERR!   code: 'EACCES',
npm ERR!   path: 'C:\\Users\\john.arnold\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm verb exit [ 1, true ]
@iarna iarna added the windows label Jun 26, 2015
@iarna iarna added this to the 3.x milestone Jun 26, 2015
@iarna iarna added bug support labels Jun 26, 2015
@iarna
Member
iarna commented Jun 26, 2015

Ok, so this is an interesting one.

It's failing because it's checking for permissions to write to C:\Users\john.arnold\AppData\Roaming\npm\node_modules\npm\node_modules and finding it doesn't have them.

On 0.12 and io.js it uses a new API call for this (that's buggy in some io.js builds), but on 0.10 it actually just creates a file and sees if it succeeded.

So it's entirely possible that I messed something up in my "create a file and check see if we succeeded" thing…

But can you verify that you can create files in C:\Users\john.arnold\AppData\Roaming\npm\node_modules\npm\node_modules ? (With, say, notepad?)

@jquense
jquense commented Jun 29, 2015

I am also running into a variant of this error as well I think. I even tried to downgrade npm to see if that fixes which (ironically) fails due to permission issues, to %USER_HOME%\AppData\Roaming\npm\node_modules\npm\node_modules. Also running node 0.10.32. Sublime can create files in that directory without issue or permission elevation.

Jumping to node 0.12.5 didn't fix it, though maybe it was already in a bad state. In any case npm deleted itself when trying to downgrade when I tried to run it again in node 0.12.5.

npm-debug

@Surreal9

I just tried npm 3 again (after rolling back to npm 2 to get back to work), and this time I'm getting the same error but it's complaining about the directory I am running npm install inside of. I do have access to create files, and can do something like 'echo Hello > test.txt' from the same shell I'm running npm from and it has no problems.

@lukeapage

Several things
a) The function is called many times - I expected it would be called once (per folder). I suspect this isn't helping. Could it be a problem with trying to unlink and open to write at the same time? Not sure.
b) I found this bug, which might be related: nodejs/node-v0.x-archive#6599 - that seems more likely

If you disable the check e.g. see the added done(); and return..

var access = fs.access
  ? function (dir, done) { fs.access(dir, fs.W_OK, done) }
  : function (dir, done) {
      done(); // this check doesn't work, assume it will run okay
      return;
      var tmp = path.join(dir, '.npm.check.permissions')
      fs.open(tmp, 'w', function (er, fd) {
        if (er) return done(accessError(dir, er))
        fs.close(fd, function () {
          fs.unlink(tmp, function () { done() })
        })
      })
    }

to here https://github.com/npm/npm/blob/master/lib/install/check-permissions.js#L77

then npm seems to install fine.

@iarna iarna modified the milestone: 3.2.0, 3.x Jul 1, 2015
@iarna
Member
iarna commented Jul 1, 2015

For 3.1.0 (this Thursday's release) I'm going to disable this check on Windows. I'll come back to it next week to find a real solution.

@iarna iarna modified the milestone: 3.1.2, 3.1.1 Jul 10, 2015
@iarna
Member
iarna commented Jul 10, 2015

I have a test branch for this, but it needs more marinating before it gets merged. NEXT WEEK!

@iarna iarna added a commit that referenced this issue Jul 18, 2015
@iarna iarna check-permissions: use inflight to eliminate duplicate checks of the …
…same resource

PR-URL: #8974
Fixes: #8701

This was breaking things on windows due to locking around the files being
created and removed.
9fafb18
@iarna
Member
iarna commented Jul 20, 2015

I believe this is fixed as of 3.1.3 but I'd love to have some of the folks who've experienced this verify that?

@iarna iarna modified the milestone: 3.x, 3.1.3 Jul 20, 2015
@lukeapage

Sorry, I'm not on 0.10.x any more

@iarna
Member
iarna commented Jul 27, 2015

I'm going to close this as resolved, but if you run into this issue again, I encourage you to open a new issue!

@iarna iarna closed this Jul 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment