【问题标题】:How to create PWA in Ionic 2?如何在 Ionic 2 中创建 PWA?
【发布时间】:2023-04-01 23:24:02
【问题描述】:

运行时出错:npm run ionic:build --prod

sh: 1: ionic-app-scripts: 未找到

npm ERR! Linux 4.4.0-62-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build" "--prod"
npm ERR! node v6.11.3
npm ERR! npm  v3.10.10
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! jaypore@0.0.1 build: `ionic-app-scripts build`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the jaypore@0.0.1 build script 'ionic-app-scripts build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the jaypore package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ionic-app-scripts build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs jaypore
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls jaypore
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /var/www/html/jp_app_pwa/npm-debug.log

sh: 1: ionic-app-scripts: not found

@ionic/app-scripts": "2.1.3

【问题讨论】:

  • 如错误信息所述,您是否安装了最新的 node 和 npm 版本?

标签: ionic-framework ionic2 ionic3 ionic-native


【解决方案1】:

试试这个link:-

首先,进入 src/index.html 并找到下面注释掉的启用 service worker 的脚本并取消注释:

<script>
  if ('serviceWorker' in navigator) {
    navigator.serviceWorker.register('service-worker.js')
      .then(() => console.log('service worker installed'))
      .catch(err => console.log('Error', err));
  }
</script>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-01-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-30
    相关资源
    最近更新 更多