Truffle: TypeError: fsevents is not a constructor at createFSEventsInstance

Created on 1 Jan 2018  Â·  14Comments  Â·  Source: trufflesuite/truffle

I am using latest version of truffle, whenever i use $ truffle serve, its throw me error

$ truffle serve
Serving static assets in ./build on port 8080…
Rebuilding…
/usr/local/lib/node_modules/truffle/build/cli.bundled.js:219284
return (new fsevents(path)).on(‘fsevent’, callback).start();
^

TypeError: fsevents is not a constructor
at createFSEventsInstance (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:219284:11)
at setFSEventsListener (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:219338:16)
at FSWatcher.FsEventsHandler._watchWithFsEvents (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:219502:16)
at FSWatcher. (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:219636:25)
at LOOP (fs.js:1716:14)
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:

Help me out to solve this issue

Environment

  • Operating System: windows 10
  • Truffle version:4.0
  • Ethereum client: go-ethereum
  • node version :9.3
  • npm version: 3.1.0

Most helpful comment

vim /usr/local/lib/node_modules/truffle/build/cli.bundled.js

// Enable fsevents on OS X when polling isn't explicitly enabled.
//if (undef('useFsEvents')) opts.useFsEvents = !opts.usePolling;

// If we can't use fsevents, ensure the options reflect it's disabled.
//if (!FsEventsHandler.canUse()) opts.useFsEvents = false;
opts.useFsEvents = false;

All 14 comments

the same problem

Serving static assets in ./build on port 8080...
/Users/sanshao/.nvm/versions/node/v8.9.3/lib/node_modules/truffle/build/cli.bundled.js:220978
return (new fsevents(path)).on('fsevent', callback).start();
^

TypeError: fsevents is not a constructor
at createFSEventsInstance (/Users/sanshao/.nvm/versions/node/v8.9.3/lib/node_modules/truffle/build/cli.bundled.js:220978:11)
at setFSEventsListener (/Users/sanshao/.nvm/versions/node/v8.9.3/lib/node_modules/truffle/build/cli.bundled.js:221032:16)
at FSWatcher.FsEventsHandler._watchWithFsEvents (/Users/sanshao/.nvm/versions/node/v8.9.3/lib/node_modules/truffle/build/cli.bundled.js:221196:16)
at FSWatcher. (/Users/sanshao/.nvm/versions/node/v8.9.3/lib/node_modules/truffle/build/cli.bundled.js:221330:25)
at gotStat (fs.js:1775:21)
at FSReqWrap.oncomplete (fs.js:152:21)

Operating
System: mac os 10.12.5
Truffle version:4..0.4
Ethereum client: go-ethereum
node version : 8.9.3
npm version: 5.5.1

the same problem

└─[0] <> truffle serve
Serving static assets in ./build on port 8080...
/usr/local/lib/node_modules/truffle/build/cli.bundled.js:220978
  return (new fsevents(path)).on('fsevent', callback).start();
          ^

TypeError: fsevents is not a constructor
    at createFSEventsInstance (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:220978:11)
    at setFSEventsListener (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:221032:16)
    at FSWatcher.FsEventsHandler._watchWithFsEvents (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:221196:16)
    at FSWatcher.<anonymous> (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:221330:25)
    at gotStat (fs.js:1810:21)
    at FSReqWrap.oncomplete (fs.js:166:21)

vim /usr/local/lib/node_modules/truffle/build/cli.bundled.js

// Enable fsevents on OS X when polling isn't explicitly enabled.
//if (undef('useFsEvents')) opts.useFsEvents = !opts.usePolling;

// If we can't use fsevents, ensure the options reflect it's disabled.
//if (!FsEventsHandler.canUse()) opts.useFsEvents = false;
opts.useFsEvents = false;

I was also facing this issue and the solution provided by @jiangcare worked for me. Thanks @jiangcare

Truffle v4.0.5 (core: 4.0.5)
Solidity v0.4.18 (solc-js)

/usr/local/Cellar/node/8.9.1/lib/node_modules/truffle/build/cli.bundled.js:220548
  return (new fsevents(path)).on('fsevent', callback).start();
          ^

TypeError: fsevents is not a constructor
    at createFSEventsInstance (/usr/local/Cellar/node/8.9.1/lib/node_modules/truffle/build/cli.bundled.js:220548:11)
    at setFSEventsListener (/usr/local/Cellar/node/8.9.1/lib/node_modules/truffle/build/cli.bundled.js:220602:16)
    at FSWatcher.FsEventsHandler._watchWithFsEvents (/usr/local/Cellar/node/8.9.1/lib/node_modules/truffle/build/cli.bundled.js:220766:16)
    at FSWatcher.<anonymous> (/usr/local/Cellar/node/8.9.1/lib/node_modules/truffle/build/cli.bundled.js:220900:25)
    at gotStat (fs.js:1775:21)
    at FSReqWrap.oncomplete (fs.js:152:21)

@rushairer Use the solution provided by @jiangcare it worked for me

It's works solution provided my @jiangcare

@Nagaraj007 why would you close this! @jiangcare's solution works, but that is not a proper solution!

I am having the same issue here. Even when I try @jiangcare solution I receive that error. I am not sure what is the issue here. Any more insight on this issue would be great!

@Nagaraj007 That is not a solution. It works but taking out the broken code is not the answer.

@Emobe @Nagaraj007 @pd164594 So from what I understand is that fsevents is an osx only pice of sowftware.

Truffle shouldn't rely on it if it's considered multiplatform or at least have a flag to opt out from the config file instead of the source code pointed out here https://github.com/trufflesuite/truffle/issues/734#issuecomment-358528186

@SachinJanani Thanks.

vim /usr/local/lib/node_modules/truffle/build/cli.bundled.js

// Enable fsevents on OS X when polling isn't explicitly enabled.
//if (undef('useFsEvents')) opts.useFsEvents = !opts.usePolling;

// If we can't use fsevents, ensure the options reflect it's disabled.
//if (!FsEventsHandler.canUse()) opts.useFsEvents = false;
opts.useFsEvents = false;
why do?

can not solve this issue,,pls details jiangcare....

Was this page helpful?
0 / 5 - 0 ratings