install package with local dependency fails

What I Wanted to Do

Actually I published a new library (vistorian-core-test) to npm, with npm publish. This package has two local dependencies (netclustering and swiftset):

{
...
   "dependencies": {
        "exorcist": "^1.0.1",
        "jquery": "^3.3.1",
        "lz-string": "^1.3.32",
        "moment": "^2.23.0",
        "netclustering": "file:netClustering-0.1.0",
        "papaparse": "^4.6.3",
        "reorder.js": "^1.0.6",
        "swiftset": "file:swiftSet-0.9.15"
    }
}

When I publish my package everything is OK.
Then I have to use this new library as a dependency in another project and the idea is that work.

What Happened Instead

The problem is the following:

npm ERR! code ENOLOCAL
npm ERR! Could not install from "node_modules\vistorian-core\netClustering-0.1.0" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Asus\AppData\Roaming\npm-cache\_logs\2019-03-26T12_33_44_884Z-debug.log

When I do npm install vistorian-core-test I get the error above and really I don’t why.

Reproduction Steps

To reproduce the error you need to do:

npm install vistorian-core-test

Details

The package.json of the new library is the following:

{
    "name": "vistorian-core-test",
    "version": "0.0.8-alpha",
    "description": "Vistorian-core is a java script / (Typescript) library and a programming framework for interactive network visualizations with:",
    "private": false,
    "types": "lib/index.d.ts",
    "scripts": {
        "build": "tsc --pretty false && rollup -c",
        "lint": "tslint -p . -e 'package.json'",
        "clean": "rimraf lib",
        "prepare": "npm run build",
    },
    "author": "Benjamin Bach <benj.bach@gmail.com>",
    "license": "MIT",
    "devDependencies": {
        "@types/jquery": "^1.10.35",
        "@types/lz-string": "^1.3.32",
        "@types/papaparse": "^4.5.7",
        "rimraf": "^2.6.3",
        "rollup": "^1.1.2",
        "rollup-plugin-commonjs": "^9.2.0",
        "rollup-plugin-json": "^3.1.0",
        "rollup-plugin-node-resolve": "^4.0.0",
        "rollup-plugin-sourcemaps": "^0.4.2",
        "source-map-support": "^0.5.10",
        "tslint": "^5.12.1",
        "typescript": "^3.2.4"
    },
    "repository": {
        "type": "git",
        "url": "git+https://github.com/networkcube/vistorian-core.git"
    },
    "collaborators": [
        "Jean-Daniel Fekete <Jean-Daniel.Fekete@inria.fr",
        "Alexandra Ibarra Cuesta"
    ],
    "homepage": "https://github.com/networkcube/vistorian-core#readme",
    "dependencies": {
        "exorcist": "^1.0.1",
        "jquery": "^3.3.1",
        "lz-string": "^1.3.32",
        "moment": "^2.23.0",
        "netclustering": "file:netClustering-0.1.0",
        "papaparse": "^4.6.3",
        "reorder.js": "^1.0.6",
        "swiftset": "file:swiftSet-0.9.15"
    }
}

and the package.json of the project where I want to install that library is:

{
    "name": "vistorian-widgets",
    "version": "0.0.1-alpha",
    "description": "Vistorian-widgets is a java script / (Typescript) library and a programming framework for interactive network visualizations with:",
    "main": "lib/index.js",
    "private": false,
    "types": "lib/index.d.js",
    "scripts": {
        "build": "tsc --pretty false && rollup -c",
        "lint": "tslint -p . -e 'package.json'",
        "clean": "rimraf lib"
    },
    "author": "Benjamin Bach <benj.bach@gmail.com>",
    "license": "MIT",
    "devDependencies": {
        "@types/jquery": "^1.10.35",
        "@types/lz-string": "^1.3.32",
        "@types/papaparse": "^4.5.7",
        "rimraf": "^2.6.3",
        "rollup": "^1.1.2",
        "rollup-plugin-commonjs": "^9.2.0",
        "rollup-plugin-json": "^3.1.0",
        "rollup-plugin-node-resolve": "^4.0.0",
        "rollup-plugin-sourcemaps": "^0.4.2",
        "source-map-support": "^0.5.10",
        "typescript": "^3.2.4",
        "tslint": "^5.12.1"
    },
    "repository": {
        "type": "git",
        "url": "git+https://github.com/networkcube/vistorian-widgets.git"
    },
    "collaborators": [
        "Jean-Daniel Fekete <Jean-Daniel.Fekete@inria.fr",
        "Alexandra Ibarra Cuesta"
    ],
    "homepage": "https://github.com/networkcube/networkcube#readme",
    "dependencies": {
        "@types/three": "^0.93.27",
        "jquery": "^3.3.1",
        "lz-string": "^1.3.32",
        "papaparse": "^4.6.3",
        "moment": "^2.23.0",
        "three": "^0.100.0",
        "vistorian-core-test": "0.0.8-alpha"
    }
}
$ npm --versions
I tried with:

v 5.10.0
v 6.4.1
v 6.9.0

pd: I saw other topics with the same problem, but anything worked for me. Sorry If I have some error when I write in English.

I don’t think local dependency should be used when publishing? See:

https://docs.npmjs.com/files/package.json#local-paths

This feature is helpful for local offline development and creating tests that require npm installing where you don’t want to hit an external server, but should not be used when publishing packages to the public registry.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.