Comments (12)
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.
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.
from create-react-pwa.
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.
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:
from create-react-pwa.
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.
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.
The solution mentioned by @dominikbulaj on also worked for me. Thanks!
from create-react-pwa.
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.
Thanks! I'll update that to remove the ''
.
from create-react-pwa.
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.
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)
- No Issue Banners on android phone (info request) HOT 2
- DOMException: unsupported MIME type for service worker HOT 17
- discussion - add demo link into document HOT 1
- Home Screen Banner Not working HOT 2
- dontCacheBustUrlsMatching regex shouldn't match domain part? HOT 1
- Licence?
- What about AppCache? HOT 2
- Support hot reload if service worker is already registered
- Demo link is 404 on Firebase HOT 1
- sw-precache ignores `swFilePath`
- Broken link to deployment site in README.md HOT 1
- Does this pwa works in other browsers as well? HOT 1
- Manifest icon + add to homescreen
- Storing Objects in java ArrayList, problem
- Problem importing manifest.json - Version 0.4.1 HOT 3
- gh-pages no longer needed... HOT 1
- Can't offline HOT 2
- Compatibility with latest create-react-app dependencies HOT 6
- README for people who haven't used create-react-app
- How to run the code please? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from create-react-pwa.