synp icon indicating copy to clipboard operation
synp copied to clipboard

Every module in package-lock.json generated by synp has empty "requires" field which result in running failure because of module loss

Open zhouyuyuyuu opened this issue 1 year ago • 0 comments

Issue description:

Background: I got an existed project which use yarn.lock and I want to convert yarn.lock to package.lock.

Steps:

  1. I run yarn install , generate node_modules.
  2. run synp --source-file yarn.lock just like the doc says. Generate package-lock.json successfully.
  3. run npm install. Got some "Cannot find module ..." error in the middle, and "remove 1842 packages... " info at the end. And, lots of dependencies in package-lock.json has been removed after running npm install!
  4. run npm run serve. Failed in error "Error: Cannot find module... "

Result: So, I converted yarn.lock to package-lock.json successfully and conveniently, but this package-lock.json cannot install module properly and of course I can't run this project using this package-lock.json.

What I found: I removed node_modules and package-lock.json and retry Step1 and 2. Find out that every module in new generated package-lock.json has empty "requires" field. I think that will result in lots of first level indirect dependency package in package-lock lose connection to other package and seems like they are dependencies of nothing. The package-lock.json whose content been cut a lot after Step3 can prove it .

Are you reporting a conversion error? Please include a link to yarn.lock / package-lock.json:

https://github.com/zhouyuyuyuu/temp/blob/main/yarn.lock

Are you reporting a conversion error? Please also include a link to your package.json:

https://github.com/zhouyuyuyuu/temp/blob/main/package.json

zhouyuyuyuu avatar May 31 '23 07:05 zhouyuyuyuu