最新消息: 电脑我帮您提供丰富的电脑知识,编程学习,软件下载,win7系统下载。

nodemon服务器命令不起作用

IT培训 admin 7浏览 0评论

nodemon服务器命令不起作用

我正在关注this guide,并且我正在该部分中,我需要运行此代码:

$ nodemon server

但是我收到此错误:

nodemon:术语'nodemon'不被识别为cmdlet,函数的名称,脚本文件或可操作程序。检查名称的拼写,或者路径是否为(包括),确认路径正确,然后重试。在第1行:char:1+ nodemon服务器+ ~~~~~~~~+ CategoryInfo:ObjectNotFound:(nodemon:String)[],CommandNotFoundExce药水+ FullyQualifiedErrorId:CommandNotFoundException

我更改了package.json中的某些设置,并在全球范围内安装了npm,但如有需要,我会再次尝试。

这是我的server.js文件:

const express = require('express');
const cors = require('cors');

require('dotenv').config();

const app = express();
const port = process.env.PORT || 5000;

app.use(cors());
app.use(express.json());

app.listen(port, () => {
    console.log(`Server is running on port: ${port}`);
});

我在错误之前已经安装好nodemon,当我安装nodemon时得到此输出。

PS C:\ Users \ username \ mern-excercise-tracker \ backend> npm install -g nodemonC:\ Users \用户名\ AppData \ Roaming \ npm \ nodemon-> C:\ Users \用户名\ AppData \ Roaming \ npm \ node_modules \ nodemon \ bin \ nodemon.js

[email protected]安装后C:\ Users \ username \ AppData \ Roaming \ npm \ node_modules \ nodemon节点bin / postinstall ||出口0

npm警告可选的跳过选择性依赖性:[email protected](node_modules \ nodemon \ node_modules \ fsevents):npm WARN notsup跳过可选依赖项:[email protected]不受支持的平台:wanted {“ os”:“ darwin”,“ arch”:“ any”}(当前:{“ os”:“ win32”,“ arch”: “ x64”})

  • [email protected]在9.852s中更新了1个程序包]
回答如下:

看看此Answer,可能会给您带来更多的见解。

除了那一种解决方法是使用npx

npx nodemon server.js

您需要[email protected]或更高。您可以通过以下方式检查您的npm版本CMD中的npm -v

nodemon服务器命令不起作用

我正在关注this guide,并且我正在该部分中,我需要运行此代码:

$ nodemon server

但是我收到此错误:

nodemon:术语'nodemon'不被识别为cmdlet,函数的名称,脚本文件或可操作程序。检查名称的拼写,或者路径是否为(包括),确认路径正确,然后重试。在第1行:char:1+ nodemon服务器+ ~~~~~~~~+ CategoryInfo:ObjectNotFound:(nodemon:String)[],CommandNotFoundExce药水+ FullyQualifiedErrorId:CommandNotFoundException

我更改了package.json中的某些设置,并在全球范围内安装了npm,但如有需要,我会再次尝试。

这是我的server.js文件:

const express = require('express');
const cors = require('cors');

require('dotenv').config();

const app = express();
const port = process.env.PORT || 5000;

app.use(cors());
app.use(express.json());

app.listen(port, () => {
    console.log(`Server is running on port: ${port}`);
});

我在错误之前已经安装好nodemon,当我安装nodemon时得到此输出。

PS C:\ Users \ username \ mern-excercise-tracker \ backend> npm install -g nodemonC:\ Users \用户名\ AppData \ Roaming \ npm \ nodemon-> C:\ Users \用户名\ AppData \ Roaming \ npm \ node_modules \ nodemon \ bin \ nodemon.js

[email protected]安装后C:\ Users \ username \ AppData \ Roaming \ npm \ node_modules \ nodemon节点bin / postinstall ||出口0

npm警告可选的跳过选择性依赖性:[email protected](node_modules \ nodemon \ node_modules \ fsevents):npm WARN notsup跳过可选依赖项:[email protected]不受支持的平台:wanted {“ os”:“ darwin”,“ arch”:“ any”}(当前:{“ os”:“ win32”,“ arch”: “ x64”})

  • [email protected]在9.852s中更新了1个程序包]
回答如下:

看看此Answer,可能会给您带来更多的见解。

除了那一种解决方法是使用npx

npx nodemon server.js

您需要[email protected]或更高。您可以通过以下方式检查您的npm版本CMD中的npm -v

与本文相关的文章

发布评论

评论列表 (0)

  1. 暂无评论