npm i egg –save npm ERR! code ENOSELF



localhost:egg shaozeming$ npm init

This utility will walk you through creating a package.json file.

It only covers the most common items, and tries to guess sensible defaults.

See `npm help json` for definitive documentation on these fields

and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and

save it as a dependency in the package.json file.

Press ^C at any time to quit.

package name: (egg)

version: (1.0.0)

description: 测试node框架

entry point: (index.js)

test command:

git repository:



license: (ISC)

About to write to /Users/shaozeming/node/egg/package.json:


  “name”: “egg”,

  “version”: “1.0.0”,

  “description”: “测试node框架”,

  “main”: “index.js”,

  “scripts”: {

    “test”: “echo \”Error: no test specified\” && exit 1″


  “author”: “”,

  “license”: “ISC”


Is this OK? (yes) yes

localhost:egg shaozeming$ npm i egg –save

npm ERR! code ENOSELF

npm ERR! Refusing to install package with name “egg” under a package

npm ERR! also called “egg”. 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!     <>

npm ERR! A complete log of this run can be found in:

npm ERR!     /Users/shaozeming/.npm/_logs/2018-11-19T05_38_10_611Z-debug.log





package.json  里面名字 和安装的插件同名了。



修改 package.json 项目名称 

"name": "egg-test",