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
.
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
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.
You don't have to delete the whole node_modules directory. Just run npm rebuild
and it will rebuild modules if they don't match your current architecture.
You need to rebuild your node_modules
if you are moving to a new machine. You can do it like this:
cd /home/jiewmeng/Dropbox/meclub
rm -rf node_modules
npm install
The reason why this is required is that the .bin
folder is full of symlinks. This will likely cause issues with Dropbox. Also, resources in the .bin
folder are sometimes compiled natively. Moving from Ubuntu to Mac OSX without recompiling, will be an issue at runtime for many components.
Just as with a VCS, I would recommend that you do not sync the node_modules
folder at all. This should not be shared between machines. You can manage these dependencies using NPM on each computer.
sails lift
or whatever you usenpm install
to make sure all the modules are installedIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With