I am trying to do a homework for a mongodb uni course. They gave us some files, instructions are:
run npm install mongodb
then node app.js
<
If you have a package-lock.json
file, you may have to delete that file then run npm i
. That worked for me
I ran into this trying to integrate React Native into an existing swift project using cocoapods. The FB docs (at time of writing) did not specify that npm install react-native
wouldn't work without first having a package.json
file. Per the RN docs set your entry point: (index.js)
as index.ios.js
npm init
is really all you needI was having the same issue - running npm install somePackage
was not generating a node_modules
dir.
I created a package.json
file at the root, which contained a simple JSON obj:
{
"name": "please-work"
}
On the next npm install
the node_modules
directory appeared.
NPM has created a node_modules directory at '/home/jasonshark/' path.
From your question it looks like you wanted node_modules to be created in the current directory.
For that,
mkdir <project-name>
cd <project-name>
npm init
This will create package.json file at current pathOpen package.json & fill it something like below
{
"name": "project-name",
"version": "project-version",
"dependencies": {
"mongodb": "*"
}
}
Now do : npm install
OR npm update
Now it will create node_modules directory under folder 'project-name' you created.
npm init
It is all you need. It will create the package.json file on the fly for you.
my problem was to copy the whole source files contains .idea directory and my webstorm terminal commands were run on the original directory of the source
I delete the .idea directory and it worked fine