0

I recently updated Nodejs to 8.11.3 from either 8.11.2 or 8.11.1, and when I ran NPM install on my project, it updated the modules and for some of the modules that I am using in my project ( most are dependencies ), for example, ip, bignumber.js, inflection, to name some specifics, npm removed the "main": attribute from the package.json file. I have the same dependencies I've always had, and never had this issue before. So when I went to run my project I got the error message:

"Cannot find module 'ip'"

for example. When I went to the git page for the module and copied the "main": attribute from the package.json on the project page, it solved the problem.

"main": "lib/ip",

What I want to know is how to get NPM from removing the "main": attribute. I need NPM to install the modules intact... I can't be making modifications to the modules to get it to work, my development machine is using Windows 10. I usually commit the project to the git on the server after I have tested it locally to know everything is working. I don't upload the modules, the server pulls the dependency modules from the repositories when I do a commit. The server uses NPM and it would not be easy to change to something else because I don't control that aspect of the server.

I don't want to worry about the same thing happening on the server...

Dan Willett
  • 945
  • 2
  • 10
  • 20
  • That sounds like a job for https://github.com/npm/npm first, rather than Stackoverflow first. Part of [search and research](/help/how-to-ask) is finding answers in the most obvious places, with SO being here for you when you've exhausted those options. – Mike 'Pomax' Kamermans Jun 25 '18 at 23:18
  • 1
    I did look, and there is nothing about this problem. Stack Overflow has an NPM tag... obviously for asking questions directly related to NPM. I have found that Stack Overflow generally has a much larger audience and a much better chance of getting a good answer to a question / problem. If you happened to find an answer, maybe you could post the link to the answer... – Dan Willett Jun 25 '18 at 23:37
  • I meant "file an issue". Asking on stackoverflow is fine but this is absolutely "file an issue first" territory, because they're the direct experts, whereas stackoverflow is second hand expertise when it comes to open source software bugs. Always ask the people who make the software either first, or before-then-also-asking here. And as a bonus, if you get an answer there, you can post that here, too, and help future visitors. – Mike 'Pomax' Kamermans Jun 26 '18 at 00:22

1 Answers1

0

It turns out there were two versions of NPM on my computer and the old version in the node directory was out of date and the Node update did not remove it.

I found this question: How do I update npm on Windows? to be useful in solving the problem.

Once I updated to the current version of npm the problem was solved.

Dan Willett
  • 945
  • 2
  • 10
  • 20