Closed jman057 closed 7 years ago
When you say "trying to install," what do you mean (specific input and output)?
It seems like you're working out of the book. Can you point to any specific pages?
What version of npm, node, and wish are you working with?
The first warnings are related to npm. Either you haven't initialized your node project properly, you are missing a package.json file or something else in that regard. However, the warnings have nothing to do with this specific project and is all regarding the use of npm.
Regarding the error:
line.fileName = line.full.match(/(/.*.js)/)[1]; ^ TypeError: Cannot read property '1' of null
Then it seems this error has something to do with #5 .
Not quite sure where the error is in the code. However, wish seems to work fine when executing a test on values that pass correctly, for example:
const wish = require('wish');
var five = function () { return 5; };
wish(five() === 5);
But I get this error as soon as I try to fail the test:
const wish = require('wish');
var five = function () { return 5; };
wish(five() === 6);
Edit: Probably should add, that I tried this using node v 8.4.0.
I am working from the book and am getting the same error:
C:\Users\Jay\Dropbox\Websites\development ebooks\node_modules\wish\lib\wish.js:8
8
line.fileName = line.full.match(/(/.*.js)/)[1];
^
TypeError: Cannot read property '1' of null
at createLineFromErrorObject (C:\Users\Jay\Dropbox\Websites\development eboo
ks\node_modules\wish\lib\wish.js:88:52)
at getExpression (C:\Users\Jay\Dropbox\Websites\development ebooks\node_modu
les\wish\lib\wish.js:107:20)
at handleFalseWish (C:\Users\Jay\Dropbox\Websites\development ebooks\node_mo
dules\wish\lib\wish.js:126:36)
at wish (C:\Users\Jay\Dropbox\Websites\development ebooks\node_modules\wish
lib\wish.js:143:15)
at Object. (C:\Users\Jay\Dropbox\Websites\development ebooks\chec
k-hand.js:3:1)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
I am trying to do the first Wish example in Chapter 4. Please advise on how to fix this?
Thanks for the replies everyone. to be honest I was able to continue with the tutorials in the book without using wish, and I have since moved on to focus on other aspects of development. Thank you for your replies, and I trust that these will benefit others with similar challenges, or me again when I next get round to testing js!
I suspect my error may have been some confusion around using npm - I still am not totally confident about where things belog in the directory structure when using the command line. I may have thought that having npm available globally meant that I didn't need the supporting files in the application folder (I now use Laravel so all this is taken care of for me).
@jman057 Sorry this didn't work for you. If you have any insights or versioning information to share, please let me know.
@Itsthatotherguy Seems like you're still having issues. IIRC, the stack trace generated for an error (which is how wish works) changed its format a ways back. I'm running wish version 5.4.2 and not getting that error. Is there a version you'd like me to try out? (npm -v wish should tell you what you're running).
Unfortunately. The book recommends 0.1.2, which I think conflicts with newer node versions. Everything works for me with wish version 5.4.2.
(EDIT, I was looking at the wrong output, I meant 1.0.0)
@Itsthatotherguy Going to close this for now, please let me know if this doesn't fix things for you.
@EvanBurchard I tried installing v5.4.2 from npm but I can't find that version. When I ran "npm install wish" yesterday, it installed v3.10.10 and that is the version that is not working. Could you provide some assistance on how to get v5.4.2 so that I can test it on my side?
@Itsthatotherguy Woah. Been a while since I looked at this. I think we're aiming for 1.0.0 actually. The command you want is npm list wish
to find out what you're using.
@EvanBurchard Here is my cmd output when I ran that command:
C:\Users\Fincon02\Documents\jstraining>npm list wish
jstraining@1.0.0 C:\Users\Fincon02\Documents\jstraining
`-- wish@1.0.0 extraneous
npm ERR! extraneous: wish@1.0.0 C:\Users\Fincon02\Documents\jstraining\node_modules\wish
@Itsthatotherguy
what about this?
npm v wish
@EvanBurchard
C:\Users\Fincon02\Documents\jstraining>npm v wish
{ name: 'wish',
description: 'Assertions without special syntax',
'dist-tags': { latest: '1.0.0' },
versions:
[ '0.0.3',
'0.0.4',
'0.0.5',
'0.0.6',
'0.0.7',
'0.0.8',
'0.0.9',
'0.0.10',
'0.1.1',
'0.1.2',
'1.0.0' ],
maintainers: [ 'evanburchard <evan.burchard@gmail.com>' ],
time:
{ modified: '2017-08-14T19:21:07.497Z',
created: '2013-03-25T13:51:23.891Z',
'0.0.3': '2013-03-25T13:51:24.889Z',
'0.0.4': '2013-03-25T14:57:17.423Z',
'0.0.5': '2013-03-25T15:22:22.636Z',
'0.0.6': '2013-03-30T08:13:04.067Z',
'0.0.7': '2016-10-11T10:41:04.891Z',
'0.0.8': '2016-10-11T13:03:07.813Z',
'0.0.9': '2016-10-11T15:17:06.839Z',
'0.0.10': '2016-10-11T15:26:12.522Z',
'0.1.1': '2016-10-12T09:23:02.347Z',
'0.1.2': '2016-10-12T09:28:49.443Z',
'1.0.0': '2017-08-14T19:21:07.497Z' },
author: 'evanburchard',
repository: { type: 'git', url: 'git://github.com/EvanBurchard/wish.git' },
homepage: 'https://github.com/EvanBurchard/wish#readme',
keywords: [ 'asset', 'test', 'assertion' ],
bugs: { url: 'https://github.com/EvanBurchard/wish/issues' },
license: 'MIT',
readmeFilename: 'README.md',
version: '1.0.0',
devDependencies: { mocha: '~1.8.2', 'deep-equal': '^1.0.1' },
scripts: { test: 'make test' },
main: 'index.js',
directories: { doc: 'docs', test: 'test' },
email: 'evan.burchard@gmail.com',
engines: { node: '>=7.7.1' },
gitHead: '7899c0e8b9795d8a56d7e3dfe4115188b3420217',
dist:
{ integrity: 'sha512-DbWUxh4tkVh5b0jQf13Nd3vpFyslQnGq3Px5Okdwo4QZAy0HQXTA7pK/i2S8Da+dU8VZCqsX799H6oQsP9mW2g==',
shasum: '45ec258501b88d4baf9ab70fc6784632e57a34d7',
tarball: 'https://registry.npmjs.org/wish/-/wish-1.0.0.tgz' } }
@Itsthatotherguy Something is weird here. Wish only goes to 1.0.0, so v3.10.10 is something else.
@EvanBurchard
C:\Users\Fincon02\Documents\jstraining>npm wish -v
3.10.10
C:\Users\Fincon02\Documents\jstraining>
Would it be better if I just start over? If yes, please list the steps that I should follow. I followed the steps listed in the book and it led me here so maybe I am getting something wrong.
~/projects/wish (master) npm whateveryouputheredoesnotmatterapparently -v
5.4.2
~/projects/wish (master) node -v
v7.7.1
I misunderstood that first command. That gives you the version of npm. So your npm version is old, and possibly your node version as well. I'd recommend updating both.
@EvanBurchard
C:\Users\Fincon02\Documents\jstraining>npm -v
5.4.2
C:\Users\Fincon02\Documents\jstraining>node -v
v8.6.0
I updated both, as requested.
However, when I tried to test it again, I got the same error:
C:\Users\Fincon02\Documents\jstraining>node check-hand.js
C:\Users\Fincon02\Documents\jstraining\node_modules\wish\lib\wish.js:88
line.fileName = line.full.match(/(\/.*\.js)/)[1];
^
TypeError: Cannot read property '1' of null
at createLineFromErrorObject (C:\Users\Fincon02\Documents\jstraining\node_modules\wish\lib\wish.js:88:52)
at getExpression (C:\Users\Fincon02\Documents\jstraining\node_modules\wish\lib\wish.js:107:20)
at handleFalseWish (C:\Users\Fincon02\Documents\jstraining\node_modules\wish\lib\wish.js:126:36)
at wish (C:\Users\Fincon02\Documents\jstraining\node_modules\wish\lib\wish.js:143:15)
at Object.<anonymous> (C:\Users\Fincon02\Documents\jstraining\check-hand.js:7:1)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
Are you running windows?
@EvanBurchard I am running Windows 10 Pro.
@Itsthatotherguy Can you try this?
git clone git@github.com:EvanBurchard/wish.git
cd wish
npm install
npm test
@EvanBurchard Getting this error:
C:\Users\Fincon02\Documents\jstraining>git clone git@github.com:EvanBurchard/wish.git
Cloning into 'wish'...
The authenticity of host 'github.com (192.30.253.113)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.253.113' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
That's weird. Do you have a "clone or download" button somewhere on this page? Can you copy and paste whatever link it gives you and clone from that?
@EvanBurchard That worked. Followed the steps you told me to, here is my output:
C:\Users\Fincon02\Documents\jstraining\wish>npm test
> wish@1.0.0 test C:\Users\Fincon02\Documents\jstraining\wish
> make test
'make' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! Test failed. See above for more details.
@Itsthatotherguy Now we're into windows specific debugging for our debugging. I don't have a windows machine, so I can't be much use diagnosing at this point.
You're probably better off just using assert
. Feel free to email me if you want advice on adapting any particular examples.
@EvanBurchard Great. Thanks. I emailed you.
Hi, trying to install this however I get an error:
I managed to get the files in "node modules/wish", however I cannot open any oft the .js files, and attempting to run the example only produces an error:
const wish = require('wish'); wish(five() === 5); wish(thisFunctionShouldBeTrue());
error:
Any ideas?
Thanks in advance!