Quantcast
Channel: npm forum - Topics tagged triaged
Viewing all articles
Browse latest Browse all 30

devDependency within a 2 depth level npm install cause the version to be unknown

$
0
0

@jbisson wrote:

What I Wanted to Do

I wanted to use npm link with multiple dept linking for dev purposes.

What Happened Instead

The version in one of the package-lock.json being generated is unknown, which leads to some problem.
IE:
{
“name”: “pkg3”,
“version”: “1.1.1”,
“lockfileVersion”: 1,
“requires”: true,
“dependencies”: {
“pkg1”: {
“version”: “1.1.1”,
“dependencies”: {
“pkg2”: {
“bundled”: true
}
}
}
}
}

Reproduction Steps

1- Create pkg1 with the following package.json:
{
“name”: “pkg1”,
“version”: “1.1.1”,
“description”: “”,
“main”: “”,
“scripts”: {
“test”: “”
},
“author”: “jbisson”,
“license”: “”,
“dependencies”: {},
“devDependencies”: {
“pkg2”: “1.1.1”
}
}

2- Create a pkg2 with the different package.json content:
{
“name”: “pkg2”,
“version”: “1.1.1”,
“description”: “”,
“main”: “”,
“scripts”: {
“test”: “”
},
“author”: “jbisson”,
“license”: “”,
“dependencies”: {},
“devDependencies”: {}
}

3- Create a pkg3 with package.json content to be:
{
“name”: “pkg3”,
“version”: “1.1.1”,
“description”: “”,
“main”: “”,
“scripts”: {
“test”: “”
},
“author”: “jbisson”,
“license”: “”,
“dependencies”: {
“pkg1”: “1.1.1”
},
“devDependencies”: {}
}

4- Go to pkg2 and run: npm install -> everything good

5- Go to pkg1 and run: npm link …/pkg2 -> everything is good
run npm install -> everything is good

6- Go to pkg3 and run npm link …/pkg1
run npm install

Open the package-lock.json from pkg3 and see the missing dependencies version for pkg2:
{
“name”: “pkg3”,
“version”: “1.1.1”,
“lockfileVersion”: 1,
“requires”: true,
“dependencies”: {
“pkg1”: {
“version”: “1.1.1”,
“dependencies”: {
“pkg2”: { // ---------------------> I would expect the version to be under here???
“bundled”: true
}
}
}
}
}

I’ve included the different package.json files within https://drive.google.com/open?id=1iDvjn7CaPTdcflLpbLfrPCVWCmgEHoen

Details

Platform Info

$ npm --versions
6.7.0

$ node -p process.platform
Linux (ubuntu)

Posts: 6

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 30

Trending Articles