Create package.json from package-lock.json

后端 未结 4 1537
星月不相逢
星月不相逢 2021-02-05 01:02

I downloaded a theme and it has a package-lock.json file but no package.json file. Is there a way I can generate the package.json from the package-lock.json file. How do I insta

4条回答
  •  天命终不由人
    2021-02-05 01:23

    I think I figured it out.

    I don't think npm init can draw from package-lock.json. However it does seem to pull from what is already in your /node_modules. I believe this is why @Harry B's solution works for some and not at all for others.

    For example, if you have just cloned your project which contains package-lock.json, no package.json, and empty/non-existence node_modules, npm init won't create any dependencies. However, if you run npm install pkg1 pkg2 pkg3 ... then run npm init it will create the dependencies in package.json.

提交回复
热议问题