Node.js npm cannot be used Solution: 1. Uninstall node.js; 2. Delete npm and npm-cache under "C:\Users\Administrator\AppData\Roaming"; 3. Reinstall Node.js is enough.
The operating environment of this article: Windows 7 system, nodejs version 8.9.3, Dell G3 computer.
What should I do if node.js npm cannot be used?
About the solution to the inability to use npm after nodejs is installed:
Because it is required to use vue in conjunction with node for project development environment deployment, try to install nodejs.
As for what others said after installing version 6, it will be stable. In fact, after installing version 6, you can use global npm.
Node.js installation package and source code download address is: https ://nodejs.org/en/download/.
##Select this Enter all the way
##Click to agree and it will be installed to the C drive by default
After installation, click the [Finish] button to complete the installation
At this point, Node.js has been installed. You can perform a simple test first to see if the installation is successful. There will be more details later. To configure the environment
Press the [win R] key on the keyboard, enter cmd, and then press Enter to open the cmd windowThis window does not have administrator rights at this time
This is an important point!!!!
## This is the normal installation effect if the C drive has not been touched before
ERR error This means the path is wrong The npm package under that folder cannot be found.
Press [win R] on the keyboard Key, enter cmd, then press Enter to open the cmd window
node -v is normal, npm -v reports an error
As shown below:
Error: Cannot find module 'internal/fs'…
The solution is as follows:
1. Uninstall node.js, specific operations:
2. Delete npm under C:\Users\Administrator\AppData\Roaming , The specific operation of npm-cache is as follows:
3. Reinstall node.js, and enter node -v and npm -v in dos again. You can see the corresponding version number as shown in the text. Shown in a picture.
Follow the steps to install once. The command to open this time must be window x
Select the command prompt (Administrator A) and click to operate
Then check node -v to view the version npm -v to view the version It will return to normal
After installation, click the [Finish] button to complete the installation
At this point, Node.js has been installed. You can first simply test whether the installation is successful, and then configure the environment.
Press the [win R] key on the keyboard, enter cmd, and then press Enter. Open the cmd window
Here is a description: The new version of Node.js has its own npm, which will be installed together when installing Node.js. The role of npm is to manage the packages that Node.js depends on, which is also understandable. What you need to install/uninstall Node.js
5. Environment Configuration
Description: The environment configuration here mainly configures the path where the global module installed by npm is located, and the path of the cache. The reason for configuring it is because it will be executed similarly in the future: When using the installation statement of npm install express [-g] (the following optional parameter -g, g represents global installation), the installed module will be installed to [C:\Users\username\AppData\Roaming\npm 】path, occupying C drive space.
For example: I want to put the path of the full module and the cache path in the folder where I installed node.js, then create two folders [node_global] under the folder I installed [D:\Develop\nodejs] ] and [node_cache] as shown below:
After creating two empty folders, open the cmd command window, enter
npm config set prefix "D:\Develop\nodejs\node_global" npm config set cache "D:\Develop\nodejs\node_cache"
, then set the environment variables, close the cmd window, "My Computer "-Right click-"Properties"-"Advanced System Settings"-"Advanced"-"Environment Variables"
Enter the environment variables dialog box, create a new [NODE_PATH] under [System Variables], enter [D:\ Develop\nodejs\node_global\node_modules], change [Path] under [User Variables] to [D:\Develop\nodejs\node_global]
6. Test
After configuration, After installing a module for testing, we will install the most commonly used express module, open the cmd window,
Enter the following command to install the module globally:
npm install express -g # -g是全局安装的意思
Add Taobao image
After installation, click the [Finish] button to complete the installation.
At this point, Node.js has been installed. You can first perform a simple test to see if the installation is successful, and then configure the environment.
On the keyboard Press the [win R] key, enter cmd, then press Enter to open the cmd window
How to use mirroring (any of the three methods can solve the problem, it is recommended to use the third method, hard-code the configuration, The configuration will still be there when you use it next time):
1. Pass the config command
npm config set registry https://registry.npm.taobao.org npm info underscore (如果上面配置正确这个命令会有字符串response)
2. Specify
npm --registry https://registry.npm.taobao.org info underscore
3 on the command line. Edit ~/.npmrc
Add the following content
registry = https://registry.npm.taobao.org
安装完后点击【Finish】按钮完成安装
至此Node.js已经安装完成,可以先进行下简单的测试安装是否成功了,后面还要进行环境配置
在键盘按下【win+R】键,输入cmd,然后回车,打开cmd窗口
推荐学习:《node.js视频教程》
The above is the detailed content of What should I do if node.js npm cannot be used?. For more information, please follow other related articles on the PHP Chinese website!

Choosing Python or JavaScript should be based on career development, learning curve and ecosystem: 1) Career development: Python is suitable for data science and back-end development, while JavaScript is suitable for front-end and full-stack development. 2) Learning curve: Python syntax is concise and suitable for beginners; JavaScript syntax is flexible. 3) Ecosystem: Python has rich scientific computing libraries, and JavaScript has a powerful front-end framework.

The power of the JavaScript framework lies in simplifying development, improving user experience and application performance. When choosing a framework, consider: 1. Project size and complexity, 2. Team experience, 3. Ecosystem and community support.

Introduction I know you may find it strange, what exactly does JavaScript, C and browser have to do? They seem to be unrelated, but in fact, they play a very important role in modern web development. Today we will discuss the close connection between these three. Through this article, you will learn how JavaScript runs in the browser, the role of C in the browser engine, and how they work together to drive rendering and interaction of web pages. We all know the relationship between JavaScript and browser. JavaScript is the core language of front-end development. It runs directly in the browser, making web pages vivid and interesting. Have you ever wondered why JavaScr

Node.js excels at efficient I/O, largely thanks to streams. Streams process data incrementally, avoiding memory overload—ideal for large files, network tasks, and real-time applications. Combining streams with TypeScript's type safety creates a powe

The differences in performance and efficiency between Python and JavaScript are mainly reflected in: 1) As an interpreted language, Python runs slowly but has high development efficiency and is suitable for rapid prototype development; 2) JavaScript is limited to single thread in the browser, but multi-threading and asynchronous I/O can be used to improve performance in Node.js, and both have advantages in actual projects.

JavaScript originated in 1995 and was created by Brandon Ike, and realized the language into C. 1.C language provides high performance and system-level programming capabilities for JavaScript. 2. JavaScript's memory management and performance optimization rely on C language. 3. The cross-platform feature of C language helps JavaScript run efficiently on different operating systems.

JavaScript runs in browsers and Node.js environments and relies on the JavaScript engine to parse and execute code. 1) Generate abstract syntax tree (AST) in the parsing stage; 2) convert AST into bytecode or machine code in the compilation stage; 3) execute the compiled code in the execution stage.

The future trends of Python and JavaScript include: 1. Python will consolidate its position in the fields of scientific computing and AI, 2. JavaScript will promote the development of web technology, 3. Cross-platform development will become a hot topic, and 4. Performance optimization will be the focus. Both will continue to expand application scenarios in their respective fields and make more breakthroughs in performance.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Zend Studio 13.0.1
Powerful PHP integrated development environment

Atom editor mac version download
The most popular open source editor

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft
