Reputation: 1
I am new to nodeJS and I am trying to install express as a dependency but it gives me error as follows::
C:\wamp\www\ExpressJS\node>npm install express --save
npm ERR! Windows_NT 10.0.10240
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install" "express" "--save"
npm ERR! node v5.3.0
npm ERR! npm v3.3.12
npm ERR! code ENOSELF
npm ERR! Refusing to install express as a dependency of itself
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! C:\wamp\www\ExpressJS\node\npm-debug.log
**any help would be much appericiated, This is my npm-debug file**
Upvotes: 0
Views: 4986
Reputation: 81
Use different name from express while initializing npm i.e while doing npm init
In your package.json check key name
"name": "express"
replace express to some other name then your error will be resolved.
Upvotes: 0
Reputation: 141
If the folder name and the package.json name
key is the same as the module name like this
terminal:
npm install express
json file:
// express/package.json
{
"name": "express",
"version": "1.0.0",
"description": "",
.
.
.
}
... < Error >.
To solve that:
json file:
// <foldername>/package.json
{
"name": "newName",
"version": "1.0.0",
"description": "",
.
.
.
}
Then
terminal:
npm install express
Upvotes: 0
Reputation: 1129
well I know what is the exact problem with you and that is, while creating the project by
npm init
you have given the name as the dependency name.
So change Name of your project by going into package.json and give a different name. And then install again by the same command like
npm install --save
and I can say that you will not get the same error again
Upvotes: 7
Reputation: 365
When start a node project, you need to use command npm init
in target folder. Then install express module.
Upvotes: 0
Reputation: 1
You're running npm i express --save
being located inside ExpressJS
folder. Please go outside and install express
there.
Upvotes: 0