Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENOENT: no such file or directory (nyc_cache) #615

Closed
garthenweb opened this issue Jun 22, 2017 · 6 comments
Closed

ENOENT: no such file or directory (nyc_cache) #615

garthenweb opened this issue Jun 22, 2017 · 6 comments
Labels

Comments

@garthenweb
Copy link

Expected Behavior

NYC should not throw when installing with npm v5 as a dependency.

Observed Behavior

Throws errors while running:

ENOENT: no such file or directory, open '.nyc_cache/429c5318ec0ecfb4d0b65d8e90260fb2_https:/registry.npmjs.org/nyc/-/nyc-11.0.2.tgz.map'

I guess this is an issue on Windows because it's working with Travis: https://travis-ci.org/garthenweb/bubleify

Bonus Points! Code (or Repository) that Reproduces Issue

https://github.com/garthenweb/bubleify/tree/chore/update-dependencies
Execute npm install && npm test in root folder with npm 5 (on windows).

Forensic Information

Operating System: Windows 10 (Powershell/ Bash on Ubuntu on Windows)
Environment Information: node v8.1.2/ npm v5.0.3

@novemberborn
Copy link
Contributor

I can't reproduce this on macOS. Given your description in #616:

npm v5 transforms the version field from the simple number to an URL of
the tgz file in the package.json when installing nyc as a dependency.

This seems like buggy behavior on npm's part. It tends to add its own fields to package.json files using an underscore prefix.

@garthenweb
Copy link
Author

I just checked the behavior one more time and can still tell that it's the same issue after removing node_modules and reinstalling again (also with npm v5.0.4). Here is the package.json in node_modules/nyc folder in case it might be helpful:

{
  "_args": [
    [
      "nyc@https://registry.npmjs.org/nyc/-/nyc-11.0.2.tgz",
      "C:\\Users\\janni\\projects\\npm-packages\\bubleify"
    ]
  ],
  "_from": "nyc@https://registry.npmjs.org/nyc/-/nyc-11.0.2.tgz",
  "_id": "nyc@11.0.2",
  "_inBundle": false,
  "_integrity": "sha1-nlkqaXGGAoJTtmhRbDjwecOcCPM=",
  "_location": "/nyc",
  "_phantomChildren": {},
  "_requested": {
    "type": "remote",
    "raw": "nyc@https://registry.npmjs.org/nyc/-/nyc-11.0.2.tgz",
    "name": "nyc",
    "escapedName": "nyc",
    "rawSpec": "https://registry.npmjs.org/nyc/-/nyc-11.0.2.tgz",
    "saveSpec": "https://registry.npmjs.org/nyc/-/nyc-11.0.2.tgz",
    "fetchSpec": "https://registry.npmjs.org/nyc/-/nyc-11.0.2.tgz"
  },
  "_requiredBy": [],
  "_spec": "https://registry.npmjs.org/nyc/-/nyc-11.0.2.tgz",
  "_where": "C:\\Users\\janni\\projects\\npm-packages\\bubleify",
  "author": {
    "name": "Ben Coe",
    "email": "ben@npmjs.com"
  },
  "bin": {
    "nyc": "./bin/nyc.js"
  },
  "bugs": {
    "url": "https://github.com/istanbuljs/nyc/issues"
  },
  "bundleDependencies": [
    "archy",
    "arrify",
    "caching-transform",
    "convert-source-map",
    "debug-log",
    "default-require-extensions",
    "find-cache-dir",
    "find-up",
    "foreground-child",
    "glob",
    "istanbul-lib-coverage",
    "istanbul-lib-hook",
    "istanbul-lib-instrument",
    "istanbul-lib-report",
    "istanbul-lib-source-maps",
    "istanbul-reports",
    "md5-hex",
    "merge-source-map",
    "micromatch",
    "mkdirp",
    "resolve-from",
    "rimraf",
    "signal-exit",
    "spawn-wrap",
    "test-exclude",
    "yargs",
    "yargs-parser"
  ],
  "contributors": [
    {
      "name": "Isaac Schlueter"
    },
    {
      "name": "Mark Wubben"
    },
    {
      "name": "James Talmage"
    },
    {
      "name": "Krishnan Anantheswaran"
    }
  ],
  "dependencies": {
    "archy": "^1.0.0",
    "arrify": "^1.0.1",
    "caching-transform": "^1.0.0",
    "convert-source-map": "^1.3.0",
    "debug-log": "^1.0.1",
    "default-require-extensions": "^1.0.0",
    "find-cache-dir": "^0.1.1",
    "find-up": "^2.1.0",
    "foreground-child": "^1.5.3",
    "glob": "^7.0.6",
    "istanbul-lib-coverage": "^1.1.1",
    "istanbul-lib-hook": "^1.0.7",
    "istanbul-lib-instrument": "^1.7.2",
    "istanbul-lib-report": "^1.1.1",
    "istanbul-lib-source-maps": "^1.2.1",
    "istanbul-reports": "^1.1.1",
    "md5-hex": "^1.2.0",
    "merge-source-map": "^1.0.2",
    "micromatch": "^2.3.11",
    "mkdirp": "^0.5.0",
    "resolve-from": "^2.0.0",
    "rimraf": "^2.5.4",
    "signal-exit": "^3.0.1",
    "spawn-wrap": "^1.3.6",
    "test-exclude": "^4.1.1",
    "yargs": "^8.0.1",
    "yargs-parser": "^5.0.0"
  },
  "description": "the Istanbul command line interface",
  "devDependencies": {
    "any-path": "^1.3.0",
    "bundle-dependencies": "^1.0.2",
    "chai": "^3.0.0",
    "coveralls": "^2.11.11",
    "exists-sync": "0.0.4",
    "forking-tap": "^0.1.1",
    "is-windows": "^1.0.0",
    "lodash": "^4.12.0",
    "mocha": "^3.2.0",
    "newline-regex": "^0.2.1",
    "requirejs": "^2.3.0",
    "sanitize-filename": "^1.5.3",
    "sinon": "^2.1.0",
    "source-map-support": "^0.4.6",
    "split-lines": "^1.0.0",
    "standard": "^9.0.2",
    "standard-version": "^4.0.0",
    "tap": "^10.0.0",
    "which": "^1.2.11",
    "zero-fill": "^2.2.3"
  },
  "files": [
    "index.js",
    "bin/*.js",
    "lib/*.js",
    "lib/commands/*.js",
    "lib/instrumenters/*.js",
    "!**/*covered.js"
  ],
  "greenkeeper": {
    "ignore": [
      "find-up"
    ]
  },
  "homepage": "https://github.com/istanbuljs/nyc#readme",
  "keywords": [
    "coverage",
    "reporter",
    "subprocess",
    "testing"
  ],
  "license": "ISC",
  "main": "index.js",
  "name": "nyc",
  "nyc": {
    "exclude": [
      "node_modules",
      "bin",
      "coverage",
      "test/fixtures/coverage.js",
      "test/build/*",
      "test/src/*",
      "test/nyc.js",
      "test/process-args.js",
      "index.covered.js",
      "test/fixtures/_generateCoverage.js"
    ]
  },
  "repository": {
    "type": "git",
    "url": "git+ssh://git@github.com/istanbuljs/nyc.git"
  },
  "scripts": {
    "build": "node ./build-tests",
    "bundle": "bundle-dependencies update",
    "clean": "rimraf ./.nyc_output ./node_modules/.cache ./.self_coverage ./test/fixtures/.nyc_output ./test/fixtures/node_modules/.cache *covered.js ./lib/*covered.js",
    "instrument": "node ./build-self-coverage.js",
    "pretest": "standard",
    "release": "standard-version",
    "report": "node ./bin/nyc  --temp-directory ./.self_coverage/ -r text -r lcov report",
    "test": "npm run clean && npm run build && npm run instrument && npm run test-integration && npm run test-mocha && npm run report",
    "test-integration": "tap -t120 --no-cov -b ./test/build/*.js && mocha --timeout=15000 ./test/nyc-bin.js",
    "test-mocha": "node ./bin/nyc --no-clean --silent --temp-directory=./.self_coverage mocha ./test/nyc.js ./test/process-args.js"
  },
  "standard": {
    "ignore": [
      "**/fixtures/**",
      "**/test/build/*"
    ]
  },
  "version": "https://registry.npmjs.org/nyc/-/nyc-11.0.2.tgz"
}

I also checked some other packages in my node_modules folder and found some with an URL and some with a simple version number. The only pattern I saw was the field _requested.type which is set to remote instead of version in the case of the full URL.

Looking forward getting more insides about this behavior.

@ScottFreeCode
Copy link

This sounds like npm/npm#17033 and npm/npm#17187

@bcoe
Copy link
Member

bcoe commented Jul 29, 2017

I believe this is an issue with npm (which should have been fixed) please feel free to reopen this issue if I'm incorrect.

@bcoe bcoe closed this as completed Jul 29, 2017
@bcoe bcoe added the triaged label Jul 29, 2017
@garthenweb
Copy link
Author

Thank you for all of your comments and investigations. I cannot reproduce this issue anymore with npm 5.3.0 :)

@bcoe
Copy link
Member

bcoe commented Jul 30, 2017

@garthenweb great 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants