我在 Windows 上遇到 Node.js 和 NPM 的问题 [英] I am having problems with Node.js and NPM on Windows

查看:36
本文介绍了我在 Windows 上遇到 Node.js 和 NPM 的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Node.js 和 NPM 的新手.我刚刚将它安装在我的计算机上,每次我尝试在 CMD 中使用命令 npm 时,它都会显示以下内容:

I am new to Node.js and NPM. I just installed it on my computer and every time I try to use the command npm in CMD it shows me the following:

推荐答案

windows 上的此消息表示未设置 NODE_PATH.

This message on windows means that NODE_PATH is not set.

你可以使用下一个bat文件

You can use next bat-file

@echo off
cd..
pushd %~dp0
set NODE_PATH=%cd%;%cd%\folder1;%cd%\folder2;
node %cd%\app.js
pause

或在 package.json 部分定义scripts/start"

or define in package.json section "scripts/start"

  "scripts" : {
    "start": "set NODE_PATH=.;./folder1;./folder2; && node app.js"
  }

并以 npm start

这篇关于我在 Windows 上遇到 Node.js 和 NPM 的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆