Jiew Meng Jiew Meng - 4 months ago 30
Node.js Question

SailsJS 0.11: ENOENT: no such file or directory, stat '.../node_modules/.bin/cdl'

Theres this

SailsJS
application that works on my office machine but not locally, I wonder why? Locally I run linux. In office Mac. Locally I get


Error: ENOENT: no such file or directory, stat
'/home/jiewmeng/Dropbox/meclub/node_modules/.bin/cdl' at Error
(native) at Object.fs.statSync (fs.js:849:18) at
/home/jiewmeng/Dropbox/meclub/node_modules/include-all/index.js:44:12
at Array.forEach (native) at requireAll
(/home/jiewmeng/Dropbox/meclub/node_modules/include-all/index.js:40:9)
at
/home/jiewmeng/Dropbox/meclub/node_modules/include-all/index.js:50:23
at Array.forEach (native) at requireAll
(/home/jiewmeng/Dropbox/meclub/node_modules/include-all/index.js:40:9)
at buildDictionary
(/home/jiewmeng/Dropbox/meclub/node_modules/sails/node_modules/sails-build-dictionary/index.js:68:14)
at Function.module.exports.optional
(/home/jiewmeng/Dropbox/meclub/node_modules/sails/node_modules/sails-build-dictionary/index.js:160:9)
at Array.async.auto.nodeModulesFolder
(/home/jiewmeng/Dropbox/meclub/node_modules/sails/lib/hooks/moduleloader/index.js:379:27)
at
/home/jiewmeng/Dropbox/meclub/node_modules/sails/node_modules/async/lib/async.js:484:38
at _each
(/home/jiewmeng/Dropbox/meclub/node_modules/sails/node_modules/async/lib/async.js:46:13)
at Object.async.auto
(/home/jiewmeng/Dropbox/meclub/node_modules/sails/node_modules/async/lib/async.js:455:9)
at Hook.loadUserHooks
(/home/jiewmeng/Dropbox/meclub/node_modules/sails/lib/hooks/moduleloader/index.js:363:13)
at Hook.bound [as loadUserHooks]
(/home/jiewmeng/Dropbox/meclub/node_modules/sails/node_modules/lodash/dist/lodash.js:729:21)
at Hook.initialize
(/home/jiewmeng/Dropbox/meclub/node_modules/sails/lib/hooks/userhooks/index.js:29:18)
at Hook.bound [as initialize]
(/home/jiewmeng/Dropbox/meclub/node_modules/sails/node_modules/lodash/dist/lodash.js:729:21)
at
/home/jiewmeng/Dropbox/meclub/node_modules/sails/lib/hooks/index.js:75:14
at
/home/jiewmeng/Dropbox/meclub/node_modules/sails/node_modules/async/lib/async.js:451:17
at
/home/jiewmeng/Dropbox/meclub/node_modules/sails/node_modules/async/lib/async.js:441:17
at _each
(/home/jiewmeng/Dropbox/meclub/node_modules/sails/node_modules/async/lib/async.js:46:13)
at Immediate.taskComplete
(/home/jiewmeng/Dropbox/meclub/node_modules/sails/node_modules/async/lib/async.js:440:13)
at processImmediate [as _immediateCallback] (timers.js:374:17)


I am using
Sails 0.11
. Server can actually start with
Sails 0.12
but theres some breaking changes, thus I am stuck with
0.11
for now. I am using
Node 4
.

Answer

I think you are using dropbox to sync office laptop with your machine, due to which some files are getting added into your project which will not cause problem in one OS but can create the issue in other.

Thus, I suggest that you should follow the standard practices to clone the project

  1. Use the git or bitbucket to clone the project.
  2. install the dependencies => npm install

Don't use dropbox for the project sync. Use the version control system to clone/pull the code, and install all dependencies

because node-gyp compiles native add-on modules for Node.js with respect to OS

and hopefully, after this it should work fine.

If you don't want to use the VCS then you can follow the below steps:

 # cd /home/jiewmeng/Dropbox/meclub
 # sudo rm -rf node_modules
 # rm -rf ~/.npm
 # npm cache clear
 # npm install

That's all you need to do.

Comments