如何在Ionic 2中创建PWA?

时间:2018-01-09 12:32:56

标签: ionic-framework ionic2 ionic3 ionic-native

跑步时出错: npm run ionic:build --prod

  

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

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

1 个答案:

答案 0 :(得分:0)

试试这个link: -

首先,进入src / index.html并找到下面注释掉的脚本,该脚本启用服务工作者并取消注释:

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