gpt4 book ai didi

node.js - nodemon bin/www 有效,nodemon 应用程序无效并抛出错误

转载 作者:太空宇宙 更新时间:2023-11-03 23:24:24 26 4
gpt4 key购买 nike

当我在应用程序中运行 nodemon bin/www 时,它运行良好,当我尝试运行 nodemon app 时,它会抛出此错误:

'\"node .\bin\www\"' is not recognized as an internal or external command,
operable program or batch file.

我相信这是在我今天收到来自nodemon的通知后发生的,运行npm install -g nodemon来更新nodemon库,安装后,我收到此错误:

Please try running this command again as root/Administrator.

我尝试以管理员身份运行cmd,再次出现同样的问题。有什么解决办法吗?

最佳答案

第 1 步:运行 npm install -g nodemon

第 2 步:验证安装 npm list -g nodemon

现在您可以通过两种方式运行应用程序

nodemon ./server.js localhost 8080

Any output from this script is prefixed with [nodemon], otherwise all output from your application, errors included, will be echoed out as expected.

第二次只需输入nodemon

If you have a package.json file for your app, you can omit the main script entirely and nodemon will read the package.json for the main property and use that value as the app.

With a local installation, nodemon will not be available in your system path. Instead, the local installation of nodemon can be run by calling it from within an npm script (such as npm start) or using npx nodemon.

It turns out that you don’t have to run the command again as Administrator, and doing so won’t fix the problem. Try

首先清理 npm 缓存。

查看更多详细信息

https://www.npmjs.com/package/fixmynode

command against as root administrator

how-to-fix-node-js-npm-permission-problems

关于node.js - nodemon bin/www 有效,nodemon 应用程序无效并抛出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46086355/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com