How to recover package.json from node_modules directory











up vote
1
down vote

favorite












I deleted the package.json in mistake but I have package-lock.json and node_modules directory and when I give the project files to my coworker he will get some errors when he wants to use gulp (because I use Macbook and my coworker uses Windows). So I think he should install all node_modules in his machine.



Is there any way to create package.json from package-lock.json or node_modules directory?










share|improve this question


















  • 2




    Well the lesson here is this is why you use source control. Fortunately you would be able to obtain "some" of the data from the package-lock.json, but it's not everything. Any scripts or metadata would be lost. I would suggest learning git or similar as a priority. Or do you actually have git or similar enabled?
    – Neil Lunn
    Nov 19 at 9:19










  • @NeilLunn Thank you for your comment, yes I use git in my projects but this project was for a previous developer and they have given me this project to continue But I do not remember that I removed the package.json or that it did not exist from the beginning
    – MajAfy
    Nov 19 at 9:23










  • First off did you check to make sure that it's not in your recycle bin (or trash I think is what it's called on mac)? Also you could probably manually install them all going through the node_modules one by one and the package.json, but it's pretty tedious.
    – jgerstle
    Nov 19 at 9:23












  • Well wer're pretty much checking down the options since "rebuilding" a package.json based on package-lock.json is a process you need to create. It's not like it's "built into npm" or anything like that. So git or "Recycle Bin" would be the most conveinent methods. And like I said, there's other data in package.json that is not listed in package-lock.json. The big difference being "dependencies" vs "devDependencies" as the "lock" does not distinguish between the two
    – Neil Lunn
    Nov 19 at 9:34

















up vote
1
down vote

favorite












I deleted the package.json in mistake but I have package-lock.json and node_modules directory and when I give the project files to my coworker he will get some errors when he wants to use gulp (because I use Macbook and my coworker uses Windows). So I think he should install all node_modules in his machine.



Is there any way to create package.json from package-lock.json or node_modules directory?










share|improve this question


















  • 2




    Well the lesson here is this is why you use source control. Fortunately you would be able to obtain "some" of the data from the package-lock.json, but it's not everything. Any scripts or metadata would be lost. I would suggest learning git or similar as a priority. Or do you actually have git or similar enabled?
    – Neil Lunn
    Nov 19 at 9:19










  • @NeilLunn Thank you for your comment, yes I use git in my projects but this project was for a previous developer and they have given me this project to continue But I do not remember that I removed the package.json or that it did not exist from the beginning
    – MajAfy
    Nov 19 at 9:23










  • First off did you check to make sure that it's not in your recycle bin (or trash I think is what it's called on mac)? Also you could probably manually install them all going through the node_modules one by one and the package.json, but it's pretty tedious.
    – jgerstle
    Nov 19 at 9:23












  • Well wer're pretty much checking down the options since "rebuilding" a package.json based on package-lock.json is a process you need to create. It's not like it's "built into npm" or anything like that. So git or "Recycle Bin" would be the most conveinent methods. And like I said, there's other data in package.json that is not listed in package-lock.json. The big difference being "dependencies" vs "devDependencies" as the "lock" does not distinguish between the two
    – Neil Lunn
    Nov 19 at 9:34















up vote
1
down vote

favorite









up vote
1
down vote

favorite











I deleted the package.json in mistake but I have package-lock.json and node_modules directory and when I give the project files to my coworker he will get some errors when he wants to use gulp (because I use Macbook and my coworker uses Windows). So I think he should install all node_modules in his machine.



Is there any way to create package.json from package-lock.json or node_modules directory?










share|improve this question













I deleted the package.json in mistake but I have package-lock.json and node_modules directory and when I give the project files to my coworker he will get some errors when he wants to use gulp (because I use Macbook and my coworker uses Windows). So I think he should install all node_modules in his machine.



Is there any way to create package.json from package-lock.json or node_modules directory?







node.js npm package.json






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 19 at 9:15









MajAfy

1,19452960




1,19452960








  • 2




    Well the lesson here is this is why you use source control. Fortunately you would be able to obtain "some" of the data from the package-lock.json, but it's not everything. Any scripts or metadata would be lost. I would suggest learning git or similar as a priority. Or do you actually have git or similar enabled?
    – Neil Lunn
    Nov 19 at 9:19










  • @NeilLunn Thank you for your comment, yes I use git in my projects but this project was for a previous developer and they have given me this project to continue But I do not remember that I removed the package.json or that it did not exist from the beginning
    – MajAfy
    Nov 19 at 9:23










  • First off did you check to make sure that it's not in your recycle bin (or trash I think is what it's called on mac)? Also you could probably manually install them all going through the node_modules one by one and the package.json, but it's pretty tedious.
    – jgerstle
    Nov 19 at 9:23












  • Well wer're pretty much checking down the options since "rebuilding" a package.json based on package-lock.json is a process you need to create. It's not like it's "built into npm" or anything like that. So git or "Recycle Bin" would be the most conveinent methods. And like I said, there's other data in package.json that is not listed in package-lock.json. The big difference being "dependencies" vs "devDependencies" as the "lock" does not distinguish between the two
    – Neil Lunn
    Nov 19 at 9:34
















  • 2




    Well the lesson here is this is why you use source control. Fortunately you would be able to obtain "some" of the data from the package-lock.json, but it's not everything. Any scripts or metadata would be lost. I would suggest learning git or similar as a priority. Or do you actually have git or similar enabled?
    – Neil Lunn
    Nov 19 at 9:19










  • @NeilLunn Thank you for your comment, yes I use git in my projects but this project was for a previous developer and they have given me this project to continue But I do not remember that I removed the package.json or that it did not exist from the beginning
    – MajAfy
    Nov 19 at 9:23










  • First off did you check to make sure that it's not in your recycle bin (or trash I think is what it's called on mac)? Also you could probably manually install them all going through the node_modules one by one and the package.json, but it's pretty tedious.
    – jgerstle
    Nov 19 at 9:23












  • Well wer're pretty much checking down the options since "rebuilding" a package.json based on package-lock.json is a process you need to create. It's not like it's "built into npm" or anything like that. So git or "Recycle Bin" would be the most conveinent methods. And like I said, there's other data in package.json that is not listed in package-lock.json. The big difference being "dependencies" vs "devDependencies" as the "lock" does not distinguish between the two
    – Neil Lunn
    Nov 19 at 9:34










2




2




Well the lesson here is this is why you use source control. Fortunately you would be able to obtain "some" of the data from the package-lock.json, but it's not everything. Any scripts or metadata would be lost. I would suggest learning git or similar as a priority. Or do you actually have git or similar enabled?
– Neil Lunn
Nov 19 at 9:19




Well the lesson here is this is why you use source control. Fortunately you would be able to obtain "some" of the data from the package-lock.json, but it's not everything. Any scripts or metadata would be lost. I would suggest learning git or similar as a priority. Or do you actually have git or similar enabled?
– Neil Lunn
Nov 19 at 9:19












@NeilLunn Thank you for your comment, yes I use git in my projects but this project was for a previous developer and they have given me this project to continue But I do not remember that I removed the package.json or that it did not exist from the beginning
– MajAfy
Nov 19 at 9:23




@NeilLunn Thank you for your comment, yes I use git in my projects but this project was for a previous developer and they have given me this project to continue But I do not remember that I removed the package.json or that it did not exist from the beginning
– MajAfy
Nov 19 at 9:23












First off did you check to make sure that it's not in your recycle bin (or trash I think is what it's called on mac)? Also you could probably manually install them all going through the node_modules one by one and the package.json, but it's pretty tedious.
– jgerstle
Nov 19 at 9:23






First off did you check to make sure that it's not in your recycle bin (or trash I think is what it's called on mac)? Also you could probably manually install them all going through the node_modules one by one and the package.json, but it's pretty tedious.
– jgerstle
Nov 19 at 9:23














Well wer're pretty much checking down the options since "rebuilding" a package.json based on package-lock.json is a process you need to create. It's not like it's "built into npm" or anything like that. So git or "Recycle Bin" would be the most conveinent methods. And like I said, there's other data in package.json that is not listed in package-lock.json. The big difference being "dependencies" vs "devDependencies" as the "lock" does not distinguish between the two
– Neil Lunn
Nov 19 at 9:34






Well wer're pretty much checking down the options since "rebuilding" a package.json based on package-lock.json is a process you need to create. It's not like it's "built into npm" or anything like that. So git or "Recycle Bin" would be the most conveinent methods. And like I said, there's other data in package.json that is not listed in package-lock.json. The big difference being "dependencies" vs "devDependencies" as the "lock" does not distinguish between the two
– Neil Lunn
Nov 19 at 9:34



















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53371458%2fhow-to-recover-package-json-from-node-modules-directory%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53371458%2fhow-to-recover-package-json-from-node-modules-directory%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

"Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

Alcedinidae

Origin of the phrase “under your belt”?