Shuping
Shuping

Reputation: 5468

Why there is no function fs.exists from Node.js on Ubuntu

I am migrating Node.js code from windows to Ubuntu 12.04, an error happens when running the code saying 'fs' has no method 'exists'. the code is like

var fs = require('fs');
fs.exists ...

I checked the doc from nodejs.org and did not found any instruction of API difference on different platforms. Did I missing anything of configuring Node.js on Ubuntu?

Upvotes: 0

Views: 349

Answers (1)

user568109
user568109

Reputation: 48003

fs.exists was added in node 0.7.1. So if you are using node before that you cannot use that function. Check your node version using node -v to confirm this.

Upvotes: 3

Related Questions