search
HomeWeb Front-endJS TutorialHow to confirm Path in node.js
How to confirm Path in node.jsDec 29, 2018 pm 04:24 PM
node.jspath

NODE_PATH is the environment variable of Node.js. The environment variable is the most basic setting value for using Node.js in the OS. Due to its importance, it is also called a system variable.

How to confirm Path in node.js

NODE_PATH describes the directory (folder) in which the Node.js module is installed. The NODE_PATH path has the meaning of the target address. In other words, if PATH is wrong, you won't reach your destination. Node.js environment variables are set with env.

How to confirm the PATH of npm

Confirm the

command in Windows 10 command prompt (on MAC terminal)

npm bin -g

Display results

C:\Users\用户名\AppData\Roaming\npm

Analysis: If you use npm bin -g to run this command, in Windows 10, a directory like C:\Users\username\AppData\Roaming\npm is installed in Node.js automatically set.

Confirm/Change the PATH of node_modules

Use the node command to execute global module paths

> global.module.paths

Instructions: By executing node at the command prompt, > ;Indicates that the node command screen is displayed at the beginning of the line.

In this state, if you execute > global.module.paths, you will see something similar to the display result

Use the node command to add node_modules 2

Add command prompt command

set NODE_PATH=C:\Users\a\AppData\Roaming\npm\node_modules2

node display command

> global.module.paths

Description: C:\Users\a\AppData\Roaming\npm\node_modules2 is added.

When NODE_PATH is not set appropriately

Error display example in command prompt

node index.jp
 > var date = require('date')
 Error: Cannot find module 'date'
 at Function._resolveFilename (index.js:332:11)

When executing index.js, if it is not set correctly In the case of NODE_PATH, since there is no path through random data, an error is displayed in the display example.

The above is the detailed content of How to confirm Path in node.js. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Vercel是什么?怎么部署Node服务?Vercel是什么?怎么部署Node服务?May 07, 2022 pm 09:34 PM

Vercel是什么?本篇文章带大家了解一下Vercel,并介绍一下在Vercel中部署 Node 服务的方法,希望对大家有所帮助!

node.js gm是什么node.js gm是什么Jul 12, 2022 pm 06:28 PM

gm是基于node.js的图片处理插件,它封装了图片处理工具GraphicsMagick(GM)和ImageMagick(IM),可使用spawn的方式调用。gm插件不是node默认安装的,需执行“npm install gm -S”进行安装才可使用。

设置Linux系统的PATH环境变量步骤设置Linux系统的PATH环境变量步骤Feb 18, 2024 pm 05:40 PM

Linux系统如何设置PATH环境变量在Linux系统中,PATH环境变量用于指定系统在命令行中搜索可执行文件的路径。正确设置PATH环境变量可以方便我们在任何位置执行系统命令和自定义命令。本文将介绍如何在Linux系统中设置PATH环境变量,并提供详细的代码示例。查看当前的PATH环境变量在终端中执行以下命令,可以查看当前的PATH环境变量:echo$P

node爬取数据实例:聊聊怎么抓取小说章节node爬取数据实例:聊聊怎么抓取小说章节May 02, 2022 am 10:00 AM

node怎么爬取数据?下面本篇文章给大家分享一个node爬虫实例,聊聊利用node抓取小说章节的方法,希望对大家有所帮助!

手把手带你使用Node.js和adb开发一个手机备份小工具手把手带你使用Node.js和adb开发一个手机备份小工具Apr 14, 2022 pm 09:06 PM

本篇文章给大家分享一个Node实战,介绍一下使用Node.js和adb怎么开发一个手机备份小工具,希望对大家有所帮助!

如何设置path环境变量如何设置path环境变量Sep 04, 2023 am 11:53 AM

设置path环境变量的方法:1、Windows系统,打开“系统属性”,点击“属性”选项,点击“高级系统设置”,在“系统属性”窗口中,选择“高级”标签,然后点击“环境变量”按钮,找到并点击“Path”编辑保存后即可;2、Linux系统,打开终端,打开你的bash配置文件,在文件末尾添加“export PATH=$PATH:文件路径”保存即可;3、MacOS系统,操作同上。

详解node中如何安装多版本并进行切换详解node中如何安装多版本并进行切换May 27, 2022 pm 08:33 PM

本篇文章给大家深入了解一下多版本node的安装方法,并详细介绍一下node版本切换方法,希望对大家有所帮助!

聊聊Node.js path模块中的常用工具函数聊聊Node.js path模块中的常用工具函数Jun 08, 2022 pm 05:37 PM

本篇文章带大家聊聊Node.js中的path模块,介绍一下path的常见使用场景、执行机制,以及常用工具函数,希望对大家有所帮助!

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment