jakearchibald / wittr

Silly demo app for an online course
385 stars 555 forks source link

After `npm install`, `npm run serve` fails #80

Open bbrudnoy opened 5 years ago

bbrudnoy commented 5 years ago

I'm unable to run this demo as part of the Offline Web Applications course on Udacity. After npm install, npm run serve fails:

$ npm run serve

> wittr@1.0.0 serve /Users/bbrudnoy/Repositories/wittr
> gulp serve

fs.js:27
const { Math, Object, Reflect } = primordials;
                                  ^

ReferenceError: primordials is not defined
    at fs.js:27:35
    at req_ (/Users/bbrudnoy/Repositories/wittr/node_modules/natives/index.js:143:24)
    at Object.req [as require] (/Users/bbrudnoy/Repositories/wittr/node_modules/natives/index.js:55:10)
    at Object.<anonymous> (/Users/bbrudnoy/Repositories/wittr/node_modules/vinyl-fs/node_modules/graceful-fs/fs.js:1:37)
    at Module._compile (internal/modules/cjs/loader.js:759:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at Function.Module._load (internal/modules/cjs/loader.js:555:12)
    at Module.require (internal/modules/cjs/loader.js:666:19)
    at require (internal/modules/cjs/helpers.js:16:16)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! wittr@1.0.0 serve: `gulp serve`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the wittr@1.0.0 serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I'm running this on macOS Mojave (v10.14.4).

castillo-media commented 5 years ago

I am having the exact same problem :( Have not found a way around it.

israelfaria commented 4 years ago

I have also hit the same issue. When you dig a little deeper there's a dependency mentioned, "natives", is screaming that it will stop working on future versions of node. I wasn't sure which version was stable when this demo project was created and then tried latests patches from 8, 10 and 12 series. It seems that 10 was the last one to work with this.

Just run this project with node 10.17.0 and you'll be fine. Now I can go back to udacity videos to follow along.

:+1:

To check the deprecation notice try this: npm show natives

khwilo commented 4 years ago

Thank you @israelfaria. Your solution has worked for me.

marlisa31 commented 4 years ago

Thanks a lot for that hint @israelfaria! Running it with node 10.17.0 was what made it work for me too.

ebdonato commented 3 years ago

Does not it have another solution yet? I am using Node for some other projects and may rollback to Node 10 is a problem.

rbicker commented 3 years ago

Hi

Another solution would be running it in docker if you don't want to locally install node 10.

cd /path/to/wittr
docker run -it --rm -v $(pwd):/usr/local/src/app -p 8888:8888 -p 8889:8889 node:10 bash
# inside container / bash shell:
cd /usr/local/src/app
npm install
npm run serve
d0rf47 commented 2 years ago

if you wish to run the project with "node": "^10.17.0" WITHOUT rolling back you global node version you can add node as a dev-dependency to the package.json and then run npm install. then you will likely see an error which will instruct you to run npm rebuild node-sass simply run that command and then you should be able to run npm run serve and view the project.