Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of npm error after nodejs installation

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "how to solve the problem of npm error after nodejs installation". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "how to solve the problem of npm error after nodejs installation"!

The solution to the npm error report after nodejs installation is: 1, download the node.js installation package on the official website; 2, decompress directly and change the file name to "nodejs7"; 3, configure environment variables; 4, configure the cache path of node.

This article operating environment: Windows7 system, nodejs7 version, DELL G3 computer

What if npm reports an error after nodejs installation?

The solution that npm does not take effect after nodejs installation is successful:

The problem reappears:

After downloading the latest version of the node-v12.18.1-x64.msi installation board on the official website and installing the next all the way, the node-v is normal and the npm-v error is as follows

0 info it worked if it ends with ok1 verbose cli ['D:\\ Program Files\\ nodejs\\ node.exe',1 verbose cli'D:\\ Program Files\\ nodejs\\ node_modules\\ npm\\ bin\\ npm-cli.js',1 verbose cli 'prefix' 1 verbose cli'- g'] 2 info using npm@6.4.13 info using node@v10.14.24 verbose stack Error: spawn D:\ Program Files\ nodejs\ node.exe ENOENT4 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:232:19) 4 verbose stack at onErrorNT (internal/child_process.js:407:16) 4 verbose stack at process._tickCallback (internal/process/next_tick.js:63:19) 5 verbose cwd C:\ Users\ Administrator6 verbose Windows_NT 10.0.162997 verbose argv "D:\\ Program Files\\ nodejs\\ node.exe"D:\\ Program Files\\ nodejs\\ node_modules\\ npm\\ bin\\ npm-cli.js"prefix"-g "8 verbose node v10.14.29 verbose npm v6.4.110 error path D:\ Program Files\ nodejs\ node.exe11 error code ENOENT12 error errno ENOENT13 error syscall spawn D:\ Program Files\ nodejs\ node.exe14 error enoent spawn D:\ Program Files\ nodejs\ node.exe ENOENT15 error enoent This is related to npm not being able to find a file.16 verbose exit [1 True]

Solution:

Download the free installation package for node.js on the official website. (zip). Download address of historical version https://nodejs.org/dist/

I installed the old version of node-v7.10.1-win-x64.zip

After downloading and decompressing directly, I will change the name of the decompressed file to nodejs7.

Then configure the environment variable: system variable-path- New: enter the unzipped installation path of your nodejs. Mine is D:\ Program Files\ nodejs7\

Then you need to manually configure the cache path of node:

1. Create node_cache and node_global folders under the node installation path you just unzipped.

2. Cmd sets the global file npm config set prefix "D:\ Program Files\ nodejs7\ node_global"

Set the cache path npm config set cache "D:\ Program Files\ nodejs7\ node_cache"

Now open cmd and type node-v npm-v to see OK.

At this point, I believe you have a deeper understanding of "how to solve the problem of npm error after nodejs installation". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report