Understanding Errors During npm Installation

Asked 2 years ago, Updated 2 years ago, 347 views

problems:
npm installation results in an error

Current State:

Download Node.js v12.19.0
  (During installation, the specified destination C:\Program Files\nodejs\  
   I installed all the settings as default.)

From the command, navigate to C:\Program Files\nodejs\ and create npm init→package.json

cd to the file where package.json was created (C:\Program Files\nodejs\node_modules\npm)

So when I did the npm installation, I got the following error:

Does anyone know how to solve this problem?
I would appreciate it if you could let me know.
I look forward to your kind cooperation.
Enter a description of the image here

node.js npm

2022-09-30 21:53

1 Answers

As @cubick commented on the error message, while running npm install from C:\Program Files\nodejs\node_modules\npm, create the folder in the C:\Program Files\nodejs\node_modules\node_modules.code.

As a countermeasure, we will refer to these articles, including those introduced in the comments:
Create Node.js Project
npm Common Command Summary
Basic Usage for npm
When you are not allowed to do npm install

Try it.

"By the way, the ""Create Node.js Project"" introduced the following guidelines, which are not limited to Node.js/npm, but also for other programs."

Also, when creating a directory, be careful not to include either a Japanese string or a blank in the path. Recently, I don't often encounter Japanese strings (full-width characters) and spaces, but I avoid them because they often cause unexpected problems.

In addition, when creating and selecting folders/directories for work (unless explicitly covered by some instructions):

  • Folder protected by the system and requiring administrator privileges for access
    For example, C:\Windows, C:\Program Files, C:\Program Files (x86), C:\ProgramData and the folder under it, and the root folder for each drive, such as C:\
    Alternatively, when you click on Explorer, "You do not have permission to access this folder. US>Click Continue to obtain permanent access to this folder (even if you have obtained access with it, you should not use it)
  • Folder where other programs are installed, folder where other programs are using it for work
  • Folder such as desktop download pictures.(Maybe the document is not good enough?)


2022-09-30 21:53

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.