简体   繁体   English

npm 错误! 缺少脚本:部署

[英]npm ERR! missing script: deploy

I am deploying my application to github pages but when I run command npm run deploy but i get error我正在将我的应用程序部署到 github 页面但是当我运行命令npm run deploy但我得到错误

npm ERR! missing script: deploy

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\whoami\AppData\Roaming\npm-cache\_logs\2020-02-05T16_46_06_946Z-debug.log

I have defined deploy in my package.json file我在 package.json 文件中定义了部署

...
"scripts": {
    "test": "jest --watchAll --verbose --coverage --runInBand",
    "start": "node index.js",
    "predeploy":"npm run build",
    "deploy":"gh-pages -d build"
  }
...

make sure you have save package.json file.确保你有保存 package.json 文件。 In my case i have not saved it so that is why error is coming在我的情况下,我没有保存它,所以这就是错误发生的原因

Please check the terminal path.请检查终端路径。 In my case, I forgot to change the directory inside my project.就我而言,我忘记更改项目中的目录。

Simply type the following:只需键入以下内容:

cd *name-of-your-project*

请关闭当前工作终端并打开新终端并重试该命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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