Command to install json-server is not working
Hello there, I am trying to make my first fake server but I couldn't because " npm install --save json-server " is not working at all
npm verison: 6.12.0 node version: 12.12.0
This is the whole error: npm ERR! code ENOSELF npm ERR! Refusing to install package with name "json-server" under a package npm ERR! also called "json-server". Did you name your project the same npm ERR! as the dependency you're installing? npm ERR! npm ERR! For more information, see: npm ERR! https://docs.npmjs.com/cli/install#limitations-of-npms-install-algorithm
npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Alisina\AppData\Roaming\npm-cache_logs\2019-11-08T22_18_10_208Z-debug.log
and my log:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Users\Alisina\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'i',
1 verbose cli 'json-server'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session fabc65bf999d99ec
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 304 https://registry.npmjs.org/json-server 833ms (from cache)
8 silly pacote tag manifest for json-server@latest fetched in 851ms
9 timing stage:loadCurrentTree Completed in 875ms
10 silly install loadIdealTree
11 silly install cloneCurrentTreeToIdealTree
12 timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms
13 silly install loadShrinkwrap
14 timing stage:loadIdealTree:loadShrinkwrap Completed in 1ms
15 silly install loadAllDepsIntoIdealTree
16 timing stage:rollbackFailedOptional Completed in 0ms
17 timing stage:runTopLevelLifecycles Completed in 878ms
18 silly saveTree [email protected]
19 verbose stack Error: Refusing to install package with name "json-server" under a package
19 verbose stack also called "json-server". Did you name your project the same
19 verbose stack as the dependency you're installing?
19 verbose stack
19 verbose stack For more information, see:
19 verbose stack https://docs.npmjs.com/cli/install#limitations-of-npms-install-algorithm
19 verbose stack at checkSelf (C:\Users\Alisina\AppData\Roaming\npm\node_modules\npm\lib\install\validate-args.js:75:14)
19 verbose stack at Array.
Hello,
Don't know if you found the solution but the error message seems to say it all
npm ERR! Refusing to install package with name "json-server" under a package npm ERR! also called "json-server". Did you name your project the
26 error Refusing to install package with name "json-server" under a package 26 error also called "json-server". Did you name your project the same 26 error as the dependency you're installing?
check if the package.json "name" property is not "json-server", this may conflict and generate this error
hello,
this is my first trial of creating fake server, using (npm install --save json-server) but facing these errors
what is problem? help me out.
Use node command prompt and type npm install -g json-server Or yarn global add json-server
It should work fine.
Thanks a lot 😊
yarn global add json-server
Thanks for the "yarn" command!! it really helped me!!