Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaking change after version 2.0.1 with Node v0.6 #1

Closed
briemens opened this issue Oct 10, 2013 · 6 comments
Closed

Breaking change after version 2.0.1 with Node v0.6 #1

briemens opened this issue Oct 10, 2013 · 6 comments

Comments

@briemens
Copy link

Recently I'm getting Travis built errors on an existing node module testing on Node v0.6.19.
This module is using Watchr, which is using type checker ~2.0.1 as a dependency.

It seems you introduced a breaking change somewhere after 2.0.1, but only marked it as a patch (by only updating the last number of the version.)

I recommend going back and change the version to 2.1.x and rollback the breaking change after 2.0.1.

> typechecker@2.0.6 preinstall /home/briemens/Development/Crafity/modules/crafity-filesystem/node_modules/watchr/node_modules/typechecker
> node ./cyclic.js


/home/briemens/Development/Crafity/modules/crafity-filesystem/node_modules/watchr/node_modules/typechecker/cyclic.js:1
'fs').existsSync
      ^
TypeError: Object #<Object> has no method 'existsSync'
    at Object.<anonymous> (/home/briemens/Development/Crafity/modules/crafity-filesystem/node_modules/watchr/node_modules/typechecker/cyclic.js:1:82)
    at Module._compile (module.js:446:26)
    at Object..js (module.js:464:10)
    at Module.load (module.js:353:31)
    at Function._load (module.js:311:12)
    at Array.0 (module.js:484:10)
    at EventEmitter._tickCallback (node.js:190:38)

npm ERR! typechecker@2.0.6 preinstall: `node ./cyclic.js`
npm ERR! `sh "-c" "node ./cyclic.js"` failed with 1
npm ERR!
npm ERR! Failed at the typechecker@2.0.6 preinstall script.
npm ERR! This is most likely a problem with the typechecker package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node ./cyclic.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls typechecker
npm ERR! There is likely additional logging output above.
npm ERR!
npm ERR! System Linux 3.8.0-27-generic
npm ERR! command "node" "/home/briemens/.nvm/v0.6.19/bin/npm" "install" "typechecker@2.0"
npm ERR! cwd /home/briemens/Development/Crafity/modules/crafity-filesystem/node_modules/watchr
npm ERR! node -v v0.6.19
npm ERR! npm -v 1.1.24
npm ERR! code ELIFECYCLE
npm ERR! message typechecker@2.0.6 preinstall: `node ./cyclic.js`
npm ERR! message `sh "-c" "node ./cyclic.js"` failed with 1
npm ERR! errno {}
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /home/briemens/Development/Crafity/modules/crafity-filesystem/node_modules/watchr/npm-debug.log
npm not ok
npm not ok

Cheers!

@briemens
Copy link
Author

The problem is with cyclic.js and the existsSync function on line 1. Which is not available before node v0.8 (was path.existsSync)

The Watchr library is depending on "typechecker": "~2.0.1", which is now broken on node v0.6.

The change to fs.existsSync is breaking other dependencies at the moment.

Here is a solution for making cyclic.js work again with older versions of node.

try {
    if (require('fs').lstatSync('.git')) {
        require('child_process').spawn(
            'npm',
            ['install', '--force', require('./package.json').name],
            {env: process.env, cwd: process.cwd(), stdio: 'inherit'}
        );
    }
} catch (err) {
    return err;
}

So the problem can be solved by using lstatSync with a try/catch around it. Easy!

I tried path.existsSync as well, but node > 0.6 prints the following warning. (not recommend)

path.existsSync is now called `fs.existsSync`.

Any chance you can fix this minor compatibility issue? Thanks!

@nishantmodak
Copy link

+1. Facing the same issue. Would be good to get this compatibility fixed.

@amb26
Copy link

amb26 commented Aug 14, 2015

What is the purpose of this file cyclic.js, and why has it found its way into so many projects?

@balupton
Copy link
Member

@amb26 if project A has a development dependency called project B that has a dependency of project A, then that creates a cyclic dependency, which npm will error about, cyclic.js fixes that error.

I'm unsure if newer versions of npm still have this issue.

@balupton
Copy link
Member

cyclic.js is maintained by the bevry/base project, https://github.com/bevry/base/blob/master/cyclic.js

TypeChecker will be updated in coming months when it is converted along with our over projects to ES6, and will get this update - details. As it seems this update is only for Node 0.6 from 2013, I don't think this of any urgency.

@balupton
Copy link
Member

Removed cyclic.js in v2.1.0, seems npm now handles cyclic dependencies correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants