What to do when "npm ERR! Code ENOSELF" is displayed after npm install

Interested in v10 released-Let's make a JS desktop application with Electron, I would like to make a desktop application using Electron. I did.

After installing Node.js, when npm install, what to do when such an error message appears.

PS C:\electron> npm install electron
npm ERR! code ENOSELF
npm ERR! Refusing to install package with name "electron" under a package
npm ERR! also called "electron". 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\user\AppData\Roaming\npm-cache\_logs\2020-09-05T13_20_15_582Z-debug.log


The error claimed that the installation could not be performed if the folder name and package name were the same. In pakege.json, it is " name ":" electron ", so I think that it can be solved by modifying this.

  "name": "electron", << "test"Should be corrected to
  "version": "1.0.0",
  "description": "",
  "scripts": {
    "start": "electron index.js"
  "keywords": [],
  "dependencies": {
    "electron": "^10.1.1"


--Corrected the project name to test. --Modified to " name ":" test " in package.json.

In my case, I have given the project name "electron" appropriately, so I have to give it another name, so I changed the project name to "test". Even if you install it as it is, you can not do it unless pakege.json is also changed, so fix that as well.

As a result, the installation was successful! !!

When deciding the project name, it was better to add "test" safely (^^;

see you!

Reference site

When you get angry like "npm ERR! Code ENOSELF npm ERR! Refusing to install package with name" gulp "under a package" after npm install

Recommended Posts

What to do when "npm ERR! Code ENOSELF" is displayed after npm install
What to do after Vagrant install
What to do when Address already in use is displayed after executing rails s
ParseException: What to do when Unparseable date is reached
After installing'devise''bootstrap' of gemfile with rails, what to do when url is an error
What to do when "Fail to load the JNI shared library" is displayed in Eclipse
What to do if FacesMessage is set but not displayed
What to do when javax.batch.operations.JobStartException occurs
[Rails] What to do when the view collapses when a message is displayed with the errors method
What to do if an error occurs when doing npm install axios in React + Typescript project
What to do when javax.el.ELException: Not a Valid Method Expression: appears when the JSF screen is displayed
What to do after updating Dockerfile, docker-compose.yml
What to do when a javax.el.PropertyNotWritableException occurs
What to do if you install Ubuntu
What to do when undefined method ʻuser_signed_in?'
[IOS] What to do when the image is filled with one color
What to do if the background image is not applied after deployment
What to do and how to install when an error occurs in DXRuby 1.4.7
What to do if an error occurs when nokogiri enters when bundle install
Notes on what to do when EC2 is set up with t2.micro
What to do if tomcat process remains when tomcat is stopped in eclipse
What to do if Operation not permitted is displayed when you execute a command in the terminal
[Rails] What to do when the Refile image is not displayed when writing the processing at the time of Routing Error
What to do when you want to delete a migration file that is "NO FILE"
What to do immediately after introducing Material Design
What to do when debugging "Source not found"
What do you use when converting to String?
What to do when IllegalStateException occurs in PlayFramework
What to do when is invalid because it does not start with a'-'
What to do when booting Ubuntu on WSL2 and getting "Process terminated with code 1"
What to do when rbenv says that there is no readline or lib history
What to do when build fails by rbenv install / pyenv install with anyenv (Debian system)
What to do when routing settings do not work after building Docker environment with Laravel
No Xcode or CLT version detected! Is displayed when npm install is performed with Laravel
What to do when The SSL certificate has expired
What to do if ClassNotFoundException occurs when starting Tomcat
What to do when a null byte error occurs
What to do when rails creates a 〇〇 2.rb file
Error ExecJS :: RuntimeUnavailable: What to do when it occurs
[Joke] What to do when the invalid sample rate is reached when using Mixxx on Ubuntu 20.04
What to do when Git Repository cannot be displayed in Team Explorer for Eclipse in Azure
[Rails 6] What to do when a missing a template error occurs after introducing haml [Super easy]
What to do when it becomes Unable to find CDI BeanManager.
[App groups] What to check when UserDefaults data is inaccessible
What to do when Method not found in f: ajax
What to do when you launch an application with rails
What to do if audio is not available on discordrb
When [command not found: composer] is displayed when [composer install] is displayed in Laravel
What to do when Cannot apply expression operators to method binding
What to do if mysql2 gets a bundle install error
[Ruby] What to do when the error "cannot load such file" appears when executing VS Code debug
[Note] What to do if bundle install in Chapter 3 of the rails tutorial is not possible
What to do when you want to know the source position where the method is defined in binding.pry
[Java] What to do if a lot of "File is opened too much" is displayed due to FileNotFoundException
What to do if the app is not created with the latest Rails version installed when rails new
What to do if you get "Changes not staged for commit:" when you git status after git add.
What is object-oriented after all?
What is object-oriented after all?
What to do if an error occurs in VS Code when importing a django module or your own module installed by pip install
Introduction to Ratpack (1) --What is Ratpack?
[Ubuntu 20.04] What to do if the external monitor is not recognized