purescript-deprecated / grunt-init-purescript

8 stars 6 forks source link

Grunt fails with "TypeError: Object #<Object> has no method 'random'" #5

Closed njbartlett closed 9 years ago

njbartlett commented 9 years ago

Followed the README for initial setup. After creating an empty PureScript project, the 'grunt' command fails with the following error:

Running "execute:tests" (execute) task
-> executing /Users/nbartlett/Development/purescript-learning/tmp/index.js
The differences of an empty list are empty.

/Users/nbartlett/Development/purescript-learning/tmp/node_modules/Control.Monad.Eff.Random/index.js:8
    return Math.random();
                ^
TypeError: Object #<Object> has no method 'random'
    at Object.random (/Users/nbartlett/Development/purescript-learning/tmp/node_modules/Control.Monad.Eff.Random/index.js:8:17)
    at __do (/Users/nbartlett/Development/purescript-learning/tmp/node_modules/Test.QuickCheck/index.js:177:52)
    at Object.__do (/Users/nbartlett/Development/purescript-learning/tmp/node_modules/Main/index.js:19:201)
    at Object.<anonymous> (/Users/nbartlett/Development/purescript-learning/tmp/index.js:1:79)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
Warning: -> error 8 /Users/nbartlett/Development/purescript-learning/tmp/index.js (102ms) Use --force to continue.

Aborted due to warnings.
paf31 commented 9 years ago

Are you using the latest version of the compiler?

The purescript-random library got broken in the most recent version, but a compiler patch fixed the issue.

paf31 commented 9 years ago

Yes, I just checked, With 0.6.7, this works for me.

You might also like to try Pulp, which takes some of the pain out of setting up a development environment if you don't need a custom workflow.

njbartlett commented 9 years ago

I'm using psc 0.6.3, which I got just hours ago via "cabal update; cabal install purescript".

Does this mean that the latest release version is non-functional, and I have to build from source?

paf31 commented 9 years ago

You need to update your cabal probably. Or depending on your OS, just download a binary bundle from GitHub releases.

njbartlett commented 9 years ago

Well I tracked it down... I have an old 0.6.3 installed, and when I did cabal install purescript today it installed 0.6.7.1 but failed to update the symlinks in ~/Library/Haskell/bin. So this is just a cabal issue, I apologise.

BTW when you say I need to update my cabal properly, what do you mean? What is improper about cabal update?

Thanks.

paf31 commented 9 years ago

"probably" not properly :P cabal update should be fine.

Yes, it sounds like this is just Cabal being difficult. You might find it easier to use the binary distributions in future, I'm not sure. They're available here: https://github.com/purescript/purescript/releases

njbartlett commented 9 years ago

I'll consider that except I assumed they lag behind somewhat. Anyway thanks for your help -- closing the issue.