Skip to content
This repository has been archived by the owner on Jul 15, 2020. It is now read-only.

Update redux example #14

Merged
merged 1 commit into from Feb 24, 2017
Merged

Update redux example #14

merged 1 commit into from Feb 24, 2017

Conversation

HaNdTriX
Copy link
Contributor

This PR uses next-redux-wrapper to simplify the redux setup.

@iaincollins
Copy link
Owner

Oh wonderful, thanks!

@iaincollins iaincollins merged commit e2a8dc6 into iaincollins:master Feb 24, 2017
@iaincollins
Copy link
Owner

iaincollins commented Feb 24, 2017

Hi, I was lazy and merged this without deploying as it ran locally (in dev and with npm run build).

It is fine locally but weirdly the build fails when deployed to now.sh.

If anyone knows what's going on here would love to know if it's something I can fix. :-)

UPDATE: It has somehow deployed okay eventually (after returning a 502 error initially) shrug will ping the Zeit folks in case it's something that needs looking at.

Deploying ~/Development/nextjs-starter
Using Node.js 7.0.0 (requested: 7.x.x)
Ready! https://nextjs-starter-ufbfpwirfq.now.sh (copied to clipboard) [2s]
Initializing…
Building
▲ npm install
▲ npm install
‣ js-yaml@3.8.1
‣ jsbn@0.1.1
‣ jsesc@1.3.0
‣ json-loader@0.5.4
‣ nodemailer-wellknown@0.1.10
‣ nopt@3.0.6
‣ normalize-package-data@2.3.5
‣ normalize-path@2.0.1
‣ now-logs@0.0.7
✓ Installed 1109 modules [31s]
▲ npm run build

nextjs-starter@2.5.20 build /home/nowuser/src
next build
Using "webpack" config function defined in next.config.js.
{ Error: ./pages/clock.js?entry
Module not found: Error: Can't resolve 'next-redux-wrapper' in '/home/nowuser/src/pages'
resolve 'next-redux-wrapper' in '/home/nowuser/src/pages'
Parsed request is a module
using description file: /home/nowuser/src/package.json (relative path: ./pages)
Field 'browser' doesn't contain a valid alias configuration
after using description file: /home/nowuser/src/package.json (relative path: ./pages)
resolve as module
/home/nowuser/node_modules doesn't exist or is not a directory
/home/node_modules doesn't exist or is not a directory
/node_modules doesn't exist or is not a directory
/home/nowuser/src/pages/node_modules doesn't exist or is not a directory
looking for modules in /home/nowuser/src/node_modules/next/node_modules
using description file: /home/nowuser/src/node_modules/next/package.json (relative path: ./node_modules)
Field 'browser' doesn't contain a valid alias configuration
after using description file: /home/nowuser/src/node_modules/next/package.json (relative path: ./node_modules)
using description file: /home/nowuser/src/node_modules/next/package.json (relative path: ./node_modules/next-redux-wrapper)
as directory
/home/nowuser/src/node_modules/next/node_modules/next-redux-wrapper doesn't exist
no extension
Field 'browser' doesn't contain a valid alias configuration
/home/nowuser/src/node_modules/next/node_modules/next-redux-wrapper doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/home/nowuser/src/node_modules/next/node_modules/next-redux-wrapper.js doesn't exist
.json
Field 'browser' doesn't contain a valid alias configuration
/home/nowuser/src/node_modules/next/node_modules/next-redux-wrapper.json doesn't exist
looking for modules in /home/nowuser/src/node_modules
using description file: /home/nowuser/src/package.json (relative path: ./node_modules)
Field 'browser' doesn't contain a valid alias configuration
after using description file: /home/nowuser/src/package.json (relative path: ./node_modules)
using description file: /home/nowuser/src/package.json (relative path: ./node_modules/next-redux-wrapper)
as directory
/home/nowuser/src/node_modules/next-redux-wrapper doesn't exist
no extension
Field 'browser' doesn't contain a valid alias configuration
/home/nowuser/src/node_modules/next-redux-wrapper doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/home/nowuser/src/node_modules/next-redux-wrapper.js doesn't exist
.json
Field 'browser' doesn't contain a valid alias configuration
/home/nowuser/src/node_modules/next-redux-wrapper.json doesn't exist
[/home/nowuser/node_modules]
[/home/node_modules]
[/node_modules]
[/home/nowuser/src/pages/node_modules]
[/home/nowuser/src/node_modules/next/node_modules/next-redux-wrapper]
[/home/nowuser/src/node_modules/next/node_modules/next-redux-wrapper]
[/home/nowuser/src/node_modules/next/node_modules/next-redux-wrapper.js]
[/home/nowuser/src/node_modules/next/node_modules/next-redux-wrapper.json]
[/home/nowuser/src/node_modules/next-redux-wrapper]
[/home/nowuser/src/node_modules/next-redux-wrapper]
[/home/nowuser/src/node_modules/next-redux-wrapper.js]
[/home/nowuser/src/node_modules/next-redux-wrapper.json]
@ ./pages/clock.js?entry 31:24-53
@ multi ./pages/clock.js?entry
at /home/nowuser/src/node_modules/next/dist/server/build/index.js:122:21
at /home/nowuser/src/node_modules/webpack/lib/Compiler.js:256:15
at Compiler.emitRecords (/home/nowuser/src/node_modules/webpack/lib/Compiler.js:351:37)
at /home/nowuser/src/node_modules/webpack/lib/Compiler.js:249:12
at /home/nowuser/src/node_modules/webpack/lib/Compiler.js:344:11
at next (/home/nowuser/src/node_modules/tapable/lib/Tapable.js:154:11)
at Compiler.compiler.plugin (/home/nowuser/src/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4)
at Compiler.applyPluginsAsyncSeries1 (/home/nowuser/src/node_modules/tapable/lib/Tapable.js:158:13)
at Compiler.afterEmit (/home/nowuser/src/node_modules/webpack/lib/Compiler.js:341:8)
at Compiler. (/home/nowuser/src/node_modules/webpack/lib/Compiler.js:336:14)
errors: [ './pages/clock.js?entry\nModule not found: Error: Can't resolve 'next-redux-wrapper' in '/home/nowuser/src/pages'\nresolve 'next-redux-wrapper' in '/home/nowuser/src/pages'\n Parsed request is a module\n using description file: /home/nowuser/src/package.json (relative path: ./pages)\n Field 'browser' doesn't contain a valid alias configuration\n after using description file: /home/nowuser/src/package.json (relative path: ./pages)\n resolve as module\n /home/nowuser/node_modules doesn't exist or is not a directory\n /home/node_modules doesn't exist or is not a directory\n /node_modules doesn't exist or is not a directory\n /home/nowuser/src/pages/node_modules doesn't exist or is not a directory\n looking for modules in /home/nowuser/src/node_modules/next/node_modules\n using description file: /home/nowuser/src/node_modules/next/package.json (relative path: ./node_modules)\n Field 'browser' doesn't contain a valid alias configuration\n after using description file: /home/nowuser/src/node_modules/next/package.json (relative path: ./node_modules)\n using description file: /home/nowuser/src/node_modules/next/package.json (relative path: ./node_modules/next-redux-wrapper)\n as directory\n /home/nowuser/src/node_modules/next/node_modules/next-redux-wrapper doesn't exist\n no extension\n Field 'browser' doesn't contain a valid alias configuration\n /home/nowuser/src/node_modules/next/node_modules/next-redux-wrapper doesn't exist\n .js\n Field 'browser' doesn't contain a valid alias configuration\n /home/nowuser/src/node_modules/next/node_modules/next-redux-wrapper.js doesn't exist\n .json\n Field 'browser' doesn't contain a valid alias configuration\n /home/nowuser/src/node_modules/next/node_modules/next-redux-wrapper.json doesn't exist\n looking for modules in /home/nowuser/src/node_modules\n using description file: /home/nowuser/src/package.json (relative path: ./node_modules)\n Field 'browser' doesn't contain a valid alias configuration\n after using description file: /home/nowuser/src/package.json (relative path: ./node_modules)\n using description file: /home/nowuser/src/package.json (relative path: ./node_modules/next-redux-wrapper)\n as directory\n /home/nowuser/src/node_modules/next-redux-wrapper doesn't exist\n no extension\n Field 'browser' doesn't contain a valid alias configuration\n /home/nowuser/src/node_modules/next-redux-wrapper doesn't exist\n .js\n Field 'browser' doesn't contain a valid alias configuration\n /home/nowuser/src/node_modules/next-redux-wrapper.js doesn't exist\n .json\n Field 'browser' doesn't contain a valid alias configuration\n /home/nowuser/src/node_modules/next-redux-wrapper.json doesn't exist\n[/home/nowuser/node_modules]\n[/home/node_modules]\n[/node_modules]\n[/home/nowuser/src/pages/node_modules]\n[/home/nowuser/src/node_modules/next/node_modules/next-redux-wrapper]\n[/home/nowuser/src/node_modules/next/node_modules/next-redux-wrapper]\n[/home/nowuser/src/node_modules/next/node_modules/next-redux-wrapper.js]\n[/home/nowuser/src/node_modules/next/node_modules/next-redux-wrapper.json]\n[/home/nowuser/src/node_modules/next-redux-wrapper]\n[/home/nowuser/src/node_modules/next-redux-wrapper]\n[/home/nowuser/src/node_modules/next-redux-wrapper.js]\n[/home/nowuser/src/node_modules/next-redux-wrapper.json]\n @ ./pages/clock.js?entry 31:24-53\n @ multi ./pages/clock.js?entry' ],
warnings: [] }
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "build"
npm ERR! Linux 4.7.0-coreos
npm ERR! code ELIFECYCLE
npm ERR! Please include the following file with any support request:
npm ERR! /home/nowuser/src/npm-debug.log
npm ERR! node v7.0.0
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nextjs-starter@2.5.20 build script 'next 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 nextjs-starter package,
npm ERR! not with npm itself.
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls nextjs-starter
npm ERR! There is likely additional logging output above.
npm ERR! Tell the author that this fails on your system:
npm ERR! next build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs nextjs-starter
npm ERR! npm v3.10.9
npm ERR! nextjs-starter@2.5.20 build: next build

@iaincollins
Copy link
Owner

iaincollins commented Feb 24, 2017

I've commented out the clock demo and removed the next-redux-wrapper package from package.json for now. :(

I've left the code in the project in as it works fine locally, but for some reason the build step fails on now.sh on that package, with the above error. It's like it can't find the package for some reason. If anyone has any idea why please let me know. :)

@HaNdTriX
Copy link
Contributor Author

Hey @iaincollins sorry for my late response. I didn't use now deployment so I did hit this bug.
After I reproduced the bug with other apps as well using now, I believe next-redux-wrapper setup (nested next setup) breaks the deployment.

To fix the problem for now we can pull in the package wich actually works pretty well without its dependencies.

HaNdTriX@02a8bf6

@kirill-konshin
Copy link

kirill-konshin commented Feb 26, 2017

I am the author of next-redux-wrapper. I tried to install your project nextjs-starter and it failed as is, so I did it this way:

git clone https://github.com/iaincollins/nextjs-starter.git
rm npm-shrinkwrap.json
npm install
now

It helped. Both npm-shrinkwrap.json and yarn.lock should be updated too when you add packages.

Deployment log:

> Deploying ~/Sites/nextjs-starter
> Using Node.js 7.0.0 (requested: `7.x.x`)
> Ready! https://nextjs-starter-ijbpqoulco.now.sh (copied to clipboard) [833ms]
> Initializing…
> Building
> ▲ npm install
>  ‣ react-dom@^15.4.2
>  ‣ react-redux@^4.4.6
>  ‣ redux@^3.6.0
>  ‣ redux-thunk@^2.1.0
>  ‣ sass-loader@^5.0.1
>  ‣ session-file-store@^1.0.0
>  ‣ sqlite3@^3.1.8
>  ‣ uuid@^3.0.1
> ✓ Using "yarn.lock"
> ✓ Installed 877 modules [14s]
> ▲ npm run build
> > nextjs-starter@2.5.19 build /home/nowuser/src
> > next build
> > Using "webpack" config function defined in next.config.js.
> ▲ npm install
>  ‣ react@^15.4.2
>  ‣ react-dom@^15.4.2
>  ‣ react-redux@^4.4.6
>  ‣ redux@^3.6.0
>  ‣ redux-thunk@^2.1.0
>  ‣ sass-loader@^5.0.1
>  ‣ session-file-store@^1.0.0
>  ‣ sqlite3@^3.1.8
>  ‣ uuid@^3.0.1
> ✓ Installed 877 modules [14s]
> ▲ npm run build
> > nextjs-starter@2.5.19 build /home/nowuser/src
> > next build
> > Using "webpack" config function defined in next.config.js.
> ▲ npm start
> > nextjs-starter@2.5.19 start /home/nowuser/src
> > node index.js
> Deployment complete!

@iaincollins
Copy link
Owner

Interesting @kirill-konshin - thanks for looking at it! Thanks also @HaNdTriX for investigating.

I am probably going to remove the yarn lockfile, which came in a previous pull request and I don't want to maintaining two sets of package metadata.

The shrinkwrap file should be correct, so that looks like an issue.

Will update and verify and roll out an update it if it works here too!

@kirill-konshin
Copy link

@iaincollins you're welcome :)

@iaincollins
Copy link
Owner

Thank you, looks like that was it! The demo is back at https://nextjs-starter.now.sh :)

I'm very happy to have this in as I wasn't quite sure how to do this myself, so thank you both for your work on it too.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants