Code Monkey home page Code Monkey logo

Comments (12)

dominikbulaj avatar dominikbulaj commented on May 18, 2024 1

Fixed issue on Windows using:
sw-precache-config.js

module.exports = {
  staticFileGlobs: [
    'build/static/**/!(*map*)',
    'build/index.html'
  ],
  stripPrefix: 'build/',
  runtimeCaching: []
};

And changing NPM scripts command to:
react-scripts build && cp manifest.json build/ && sw-precache --config=sw-precache-config.js --verbose

from create-react-pwa.

rajesh-wankhede avatar rajesh-wankhede commented on May 18, 2024 1
G:\node\create-react-pwa-master>npm run-script build

> [email protected] build G:\node\create-react-pwa-master
> react-scripts build && cp manifest.json build/ && sw-precache --root='build/'
--static-file-globs='build/**/!(*map*)'

Creating an optimized production build...
Compiled successfully.

File sizes after gzip:

  47.02 KB  build\static\js\main.07af1858.js
  289 B     build\static\css\main.9a0fe4f1.css

You can now publish them at ./.
For example, if you use GitHub Pages:

  git commit -am "Save local changes"
  git checkout -B gh-pages
  git add -f build
  git commit -am "Rebuild website"
  git filter-branch -f --prune-empty --subdirectory-filter build
  git push -f origin gh-pages
  git checkout -


'cp' is not recognized as an internal or external command,
operable program or batch file.

npm ERR! Windows_NT 10.0.10240
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\******\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run-script" "build"
npm ERR! node v4.4.7
npm ERR! npm  v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! [email protected] build: `react-scripts build && cp manifest.json build/ && sw-precache --root='build/' --static-file-globs='build/**/!(*map*)'`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script 'react-scripts build && cp manifest.json build/ && sw-precache --root='build/' --static-file-globs='build/**/
!(*map*)''.
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 create-react-pwa package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     react-scripts build && cp manifest.json build/ && sw-precache --root='build/' --static-file-globs='build/**/!(*map*)'
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs create-react-pwa
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls create-react-pwa
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     G:\node\create-react-pwa-master\npm-debug.log

G:\node\create-react-pwa-master>

from create-react-pwa.

rajesh-wankhede avatar rajesh-wankhede commented on May 18, 2024 1

from create-react-pwa.

jeffposnick avatar jeffposnick commented on May 18, 2024

Does it fail the same way in both cmd and git bash? The output you're providing looks like it's from cmd.

I don't have a Windows machine handy to test, but I'll try when I can get my hands on one.

from create-react-pwa.

dominikbulaj avatar dominikbulaj commented on May 18, 2024

Same here. Same on bash (and cmd):

$ npm run-script build

> [email protected] build C:\Projekty\nm-vagrant\netmoms-pwa
> react-scripts build && cp manifest.json build/ && sw-precache --root='build/' --static-file-globs='build/**/!(*map*)'

Creating an optimized production build...
Compiled successfully.

File sizes after gzip:

  47.15 KB  build\static\js\main.836cae05.js
  289 B     build\static\css\main.9a0fe4f1.css

The project was built assuming it is hosted at ./.
You can control this with the homepage field in your package.json.

The build folder is ready to be deployed.

' was unexpected at this time.

C:\Projekty\nm-vagrant\netmoms-pwa>  "C:\Projekty\nm-vagrant\netmoms-pwa\node_modules\.bin\\node.exe"  "C:\Projekty\nm-vagrant\netmoms-pwa\node_modules\.bin\\..\sw-precache\cli.js" --root='build/' --static-file-globs
='build/**/!(*map*)'

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Dominik\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run-script" "build"
npm ERR! node v4.4.1
npm ERR! npm  v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! [email protected] build: `react-scripts build && cp manifest.json build/ && sw-precache --root='build/' --static-file-globs='build/**/!(*map*)'`
npm ERR! Exit status 255
npm ERR!
npm ERR! Failed at the [email protected] build script 'react-scripts build && cp manifest.json build/ && sw-precache --root='build/' --static-file-globs='build/**/!(*map*)''.
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 my-pwa package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     react-scripts build && cp manifest.json build/ && sw-precache --root='build/' --static-file-globs='build/**/!(*map*)'
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs my-pwa
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls my-pwa
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Projekty\nm-vagrant\netmoms-pwa\npm-debug.log

Result - build folder created but no service worker inside it:
screenshot_4

from create-react-pwa.

jordaofranca avatar jordaofranca commented on May 18, 2024

react-create-app changed the structure of files and folders. Index html was moved to public folder. Please change the configuration to the new structure mr. @jeffposnick .

from create-react-pwa.

jeffposnick avatar jeffposnick commented on May 18, 2024

Apologies about that. This project is unfortunately going to periodically get out of sync with create-react-app and its dependencies, but I will try to be more proactive about keeping it up to date.

I've got #7 open to track compatibility with the latest release on all platforms, but I'll leave this open to track Windows in particular, and make sure that it works in Windows after making the changes.

from create-react-pwa.

patitonar avatar patitonar commented on May 18, 2024

The solution mentioned by @dominikbulaj on also worked for me. Thanks!

from create-react-pwa.

jeffposnick avatar jeffposnick commented on May 18, 2024

I've updated things with an example of using the latest create-react-app dependency.

Can you take a look at c-r-a-0.6.0...c-r-pwa-0.6.0 and confirm that making those changes to something scaffolded with the latest create-react-app works for you?

I don't see any reason why it would not work on Windows, but I tend to be surprised by the little things that don't work as expected...

from create-react-pwa.

jeffposnick avatar jeffposnick commented on May 18, 2024

Thanks! I'll update that to remove the ''.

from create-react-pwa.

sxu2583 avatar sxu2583 commented on May 18, 2024

What do you mean by this ?

And changing NPM scripts command to:
react-scripts build && cp manifest.json build/ && sw-precache --config=sw-precache-config.js --verbose

from create-react-pwa.

rajesh-wankhede avatar rajesh-wankhede commented on May 18, 2024

The changes I made in build script is working in Windows . If ur not a Windows user than keep it as it is.

from create-react-pwa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.