简体   繁体   中英

Nodemon not found on Azure

I'm trying to develop an application which is via Ionic and Node.js. I have deployed the service to Azure but i have problem with nodemon;

package.json

"scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "nodemon server.js"
  }

in this way, it's working properly in localhost.

But it doesn't work on azure.

debug log on azure

在此处输入图片说明

Thanks a lot..

According to the error information, it indicates that there is no nodemon installed. Please have a try to install the nodemon with kudu tool ( https://yousitename.scm.azurewebsites.net/ ).

npm install -g nodemon

Install it :

  • Click Add Task, on the left, search for npm on the right.
  • Select npm (run an npm command) and click Add.
  • Enter a name such as install the Nodemon.
  • Enter the npm command as install.
  • Enter the arguments as nodemon -g.

You don't necessarily have to install the nodemon globally.

It's possible to install it as dependency with the normal npm install nodemon command then use npx nodemon in your npm start command:

"scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "npx nodemon server.js"
}

You can also install nodemon with the --save-dev flag but note that in your server if you install the dependencies using --production (or when the NODE_ENV environment variable is set to production ), npm will not install modules listed in devDependencies .

Edit:

npx do not require to have the package as dependency and will also work when you have a devDependencies not installed in NODE_ENV=production environment, in this case npx will install the package from the npm registry and run the binary.

Check here for some introduction about npx from NPM .

Also, check this recommendations how to use nodemon for production environments.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM