I'm using latest npm, on a mac. I've got a strange problem: if I want to install some package locally on a folder, I'm forced to npm init it. In other words, if I simply npm install [package name], it will install globally (in my /User/npm-modules folder), and thus the onnly way to install locally is to init the folder. So basically, the opposite it should normally do. Why? Any idea?
npm init creates package.json file in your current project directory. npm packages will install locally when you have package.json set up by using the command npm i PACKAGE-NAME.
Yes, if you want to install package localy, you need to create package.json file. This is what npm init will do and then you can install packages
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With