npm install
/ npm install -g
command is not working in Windows 7
Node.js is installed properly, node.js version is v0.10.28
Couldn't read dependencies
ENOENT, open '"filepath"\package.json'
This is most likely not a problem with npm itself.
npm can't find a package.json file in your current directory.
Use below command to create a package.json file.
[This method will generate a default package.json using information extracted from the current directory.]
Working with package.json
In my case there was mistake in my package.json:
npm ERR! package.json must be actual JSON, not just JavaScript.
node
comes withnpm
installed so you should have a version ofnpm
, howevernpm
gets updated more frequently thannode
does, so you'll want to make sure it's the latest version.Test: Run
npm -v
. The version should be higher than 2.1.8.THAT'S IT!
https://www.youtube.com/watch?v=wREima9e6vk
You don't say what module you want to install - hence npm looks for a file
package.json
which describes your dependencies, and obviously this file is missing.So either you have to explicitly tell npm which module to install, e.g.
or
or you have to add a
package.json
file and register your modules here. The easiest way to get such a file is to let npm create one by runningand then add what you need. Please note that this does only work for locally installed modules, not for global ones.
A simple example might look like this:
or something like that. For more info on the
package.json
file see its official documentation and this interactive guide.>> For Visual Studio Users using Package Manager Console <<
If you are using the Package Manager Console in Visual Studio and you want to execute:
npm install
and get:Verify that you are executing the command in the correct directory.
VS by default uses the solution folder when opening the Package Manager Console.
Execute
dir
then you can see in which folder you currently are. Most probably in the solution folder, that's why you get this error. Now you have tocd
to your project folder.cd YourWebProject
Now
npm install
should work now, if not, then you have another issue.I'm not sure what you're trying to do here:
npm install
alone in your home directory shouldn't do much -- it's not the root of a node app, so there's nothing to install, since there's no package.json.There are two possible solutions:
1)
cd
to a node app and runnpm install
there. OR2) if you're trying to install something as a command to use in the shell (You don't have a node application),
npm install -g packagename
.-g
flag tells it to install in global namespace.