mkdir newproj && cd newproj
npm init -y
npm i -S [email protected]
node -e 'require("sinon")'
Output:
/Users/thom/dev/voltserver/etx800/newproj/node_modules/just-extend/index.js:40
throw new Error('expected object, got ' + arg);
^
Error: expected object, got function FakeXMLHttpRequest(config) {
EventTargetHandler.call(this);
this.readyState = FakeXMLHttpRequest.UNSENT;
this.requestHeaders = {};
this.requestBody = null;
this.status = 0;
this.statusText = "";
this.upload = new EventTargetHandler();
this.responseType = "";
this.response = "";
this.logError = configureLogError(config);
if (sinonXhr.supportsTimeout) {
this.timeout = 0;
}
if (sinonXhr.supportsCORS) {
this.withCredentials = false;
}
if (typeof FakeXMLHttpRequest.onCreate === "function") {
FakeXMLHttpRequest.onCreate(this);
}
}
at extend (/Users/thom/dev/voltserver/etx800/newproj/node_modules/just-extend/index.js:40:13)
at Object.<anonymous> (/Users/thom/dev/voltserver/etx800/newproj/node_modules/nise/lib/fake-xhr/index.js:651: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)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/thom/dev/voltserver/etx800/newproj/node_modules/nise/lib/fake-server/index.js:3:15)
In fact this looks like an error in just-extend since a release was just published hours ago.
$ npm ls just-extend
[email protected] /Users/thom/dev/voltserver/etx800/newproj
โโโฌ [email protected]
โโโฌ [email protected]
โโโ [email protected]
$ node --version
v6.11.0
Edit: The bug has now been fixed in just-extend, so you shouldn't need to do this any more.
For those using yarn, you can work around this issue for now by adding this to your package.json:
"resolutions": {
"just-extend": "1.1.22"
}
I'm not sure if there's an equivalent feature for npm. Perhaps someone else can share.
@camjackson
The best npm workaround I could come up with is running npm install, deleting just-extend, and explicitly installing just-extend version 1.1.22.
npm install && rm -rf node_modules/just-extend/ && npm install [email protected]
Same here, this issue occurs today with me
The direct dependency with the issue is nise and it's got an issue open.
https://github.com/sinonjs/nise/issues/17 -> https://github.com/angus-c/just/issues/70
As for npm you can add it to your package.json's devdeps
{
"devDependencies": {
"just-extend": "1.1.22"
}
}
Very sorry for this. Latest just-extend (v1.1.26) should fix this
I can confirm the latest version of just-extend works for me as well.
Running the problematic commands now just works without throwing any errors.
$ mkdir newproj && cd newproj
$ npm init -y
$ npm i -S [email protected]
[email protected] /.../newproj
โโโฌ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโฌ [email protected]
โ โโโ [email protected]
โ โโโ [email protected]
โโโฌ [email protected]
โ โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
โโโ [email protected]
$ node
> var sinon = require('sinon');
undefined
>
I'm also able to remove any yarn selective version resolutions I was using before. Thanks @angus-c for the fix, and @camjackson for the yarn workaround.
I have sinon v 4.0.0 and downgraded it to 3.2.1 but still not working,
also i don't have the just-extend as dep in my project
@m1m6 what does npm ls just-extend show?
@angus-c
+-- UNMET PEER DEPENDENCY [email protected]
+-- UNMET PEER DEPENDENCY [email protected] || 0.20.x || 0.22.x || 1.0.0-rc.1
+-- UNMET PEER DEPENDENCY [email protected]
+-- UNMET PEER DEPENDENCY [email protected]
+-- [email protected]
+-- UNMET PEER DEPENDENCY popper.js@^1.12.3
+-- UNMET PEER DEPENDENCY [email protected]
+-- UNMET PEER DEPENDENCY [email protected]
`-- UNMET PEER DEPENDENCY [email protected]
npm ERR! peer dep missing: chai@>=1.9.2 <4, required by [email protected]
npm ERR! peer dep missing: [email protected] || ^2.3.0, required by [email protected]
npm ERR! peer dep missing: enzyme@^2.0.0, required by [email protected]
npm ERR! peer dep missing: eslint-plugin-jsx-a11y@^5.1.1, required by [email protected]
npm ERR! peer dep missing: react@^0.14.7 || ^15.0.1, required by [email protected]
npm ERR! peer dep missing: react@^0.14.0 || ^15.0.0, required by [email protected]
npm ERR! peer dep missing: react@^0.14.0 || ^15.0.0, required by [email protected]
npm ERR! peer dep missing: react@^0.14.0 || ^15.0.0-0, required by [email protected]
npm ERR! peer dep missing: react@^15.0.0, required by [email protected]
npm ERR! peer dep missing: react@^15.0.0, required by [email protected]
npm ERR! peer dep missing: react@^0.14.0 || ^15.0.0, required by [email protected]
npm ERR! peer dep missing: react@^0.14.0 || ^15.0.0, required by [email protected]
npm ERR! peer dep missing: react@^0.14.9 || ^15.3.0, required by [email protected]
npm ERR! peer dep missing: react@^0.14.0, required by [email protected]
npm ERR! peer dep missing: react-dom@^0.14.0 || ^15.0.0-0, required by [email protected]
npm ERR! peer dep missing: react-dom@^15.4.2, required by [email protected]
npm ERR! peer dep missing: sinon@>=1.4.0 <2, required by [email protected]
npm ERR! peer dep missing: popper.js@^1.12.3, required by [email protected]
npm ERR! peer dep missing: [email protected] || 0.20.x || 0.22.x || 1.0.0-rc.1, required by [email protected]
Might need to rm -rf node_modules && npm i ?
@angus-c i removed the whole node-modules folder
and reinstall all dep's , still the same
Hmm I'm not sure what the issue is. The following works for me now:
mkdir newproj && cd newproj
npm init -y
npm i -S [email protected]
node -e 'require("sinon")'
@m1m6 If you don't have that dependency, then you are experiencing another bug. Please open another bug report and fill out the template - especially the part that shows your exception's stack trace.
Closing this as a non-issue in Sinon, seeing that this was resolved outside of Sinon.
@angus-c thank's it works now after clearing the node modules again and reinstall all dep, also i faced the same with bitbucket pipelines clearing the cached modules and re install solves the problem there.
@fatso83 it's the same problem ๐
@m1m6, I thought you meant you didn't have that dependency _at all_ (including transitive dependencies). This relates to sinonjs/nise#17. We will need to update nise to close this.
Version 4.0.2 is published with a fix for this.
Most helpful comment
Edit: The bug has now been fixed in
just-extend, so you shouldn't need to do this any more.For those using yarn, you can work around this issue for now by adding this to your
package.json:I'm not sure if there's an equivalent feature for npm. Perhaps someone else can share.