nothingworksinc / ticketbeast

Back to the lesson videos:
https://course.testdrivenlaravel.com/lessons
552 stars 11 forks source link

Stuck on Moment of Truth as `npm run dev` fails #98

Closed jayhealey closed 5 years ago

jayhealey commented 5 years ago

EDIT: Solved - see last comment!

Description

I'm on module 9, on the final video Moment of Truth and currently unable to test the payment with Stripe using the UI.

I hadn't touched any of the front-end stuff yet, so I've merged in the changes from this commit.

Turns out the the javascript which uses the local API was commented out, so I've uncommented it out and ran npm run dev.

I then see the following:

Error message

npm run dev

> @ dev /Users/james/Code/ticketbeast
> gulp watch

fs.js:27
const { Math, Object } = primordials;
                         ^
ReferenceError: primordials is not defined
    at fs.js:27:26
    at req_ (/Users/james/Code/ticketbeast/node_modules/natives/index.js:143:24)
    at Object.req [as require] (/Users/james/Code/ticketbeast/node_modules/natives/index.js:55:10)
    at Object.<anonymous> (/Users/james/Code/ticketbeast/node_modules/graceful-fs/fs.js:1:37)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:643:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Module.require (internal/modules/cjs/loader.js:683:19)
    at require (internal/modules/cjs/helpers.js:16:16)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ dev: `gulp watch`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/james/.npm/_logs/2019-07-18T10_15_39_749Z-debug.log

Any help is appreciated - thank you.

Versions

niektenhoopen commented 5 years ago

What is your gulp version?

Asking because this was the first Google search result on your error: https://stackoverflow.com/questions/55921442/how-to-fix-referenceerror-primordials-is-not-defined-in-node

jayhealey commented 5 years ago

@niektenhoopen Good point. I didn't have it installed - my bad.

However, after installing it I'm seeing no change in the error message.

Apparently the combination of node 12 and gulp 3 doesn't work.

jayhealey commented 5 years ago

Solved!

Here's how to unlink Node and install v10 using Brew:

brew unlink node
brew install node@10
brew link node@10 --force

Then in the ticketbeast folder make sure to: rm -rf node_modules && npm install

Then to run mix: npm run dev

Done!

Reduxx commented 5 years ago

Installing an older version might not be possible for all folks, and reinstalling it on every other project they work on. I personally use a tool called nvm.

It allows you to install multiple node versions simultaneously on your machine via nvm install node nvm install 10

or whatever version you like, and you can easily switch which version is used by nvm use {version} where version is the version you'd like to use.

To check all installed versions just run nvm list

jayhealey commented 5 years ago

@reduxx Ah, great to know - thank you very much. Front-end tooling is not my speciality so this is very helpful.