Strugging to get tower.js installed on my snow leopard macbook. Here is the command and the error:
My-Macbook:tower john$ tower new app
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Object #<Object> has no method 'existsSync'
at Object.<anonymous> (/usr/local/lib/node_modules/tower/index.js:6:21)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:31)
at Function._load (module.js:308:12)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at Object.<anonymous> (/usr/local/lib/node_modules/tower/bin/tower:15:3)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
Beginning with Node.js 0.8, what was path.existsSync() is now fs.existsSync() - the version of tower.js that you're using seems to be incompatible with the installed Node.js version.
Related
Using this with some Kubernetes PODS and one of the pods out of the blue gives me this error. It seems to come from the call on line 6. Have not changed anything was just doing a deployment on gitlab and noticed this POD said CrashLoopBackOff.
/app/config/auth.js line 6
var dateFormat = require('dateformat');
My nodemodules folder has the latest dateFormat.js from package.json
So not sure what the problem is. Does someone know how to fix it?
var token=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g;var timezone=/\b(?:[A-Z]{1,3}[A-Z][TC])(?:[-+]\d{4})?|((?:Australian )?(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time)\b/g;var timezoneClip=/[^-+\dA-Z]/g;export default function dateFormat(date,mask,utc,gmt){if(arguments.length===1&&typeof date==="string"&&!/\d/.test(date)){mask=date;date=undefined}date=date||date===0?date:new Date;if(!(date instanceof Date)){date=new Date(date)}if(isNaN(date)){throw TypeError("Invalid date")}mask=String(masks[mask]||mask||masks["default"]);var maskSlice=mask.slice(0,4);if(maskSlice==="UTC:"||maskSlice==="GMT:"){mask=mask.slice(4);utc=true;if(maskSlice==="GMT:"){gmt=true}}var _=function _(){return utc?"getUTC":"get"};var _d=function d(){return date[_()+"Date"]()};var D=function D(){return date[_()+"Day"]()};var _m=function m(){return date[_()+"Month"]()};var y=function y(){return date[_()+"FullYear"]
SyntaxError: Unexpected token export
at Module._compile (internal/modules/cjs/loader.js:760:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
at Module.load (internal/modules/cjs/loader.js:685:32)
at Function.Module._load (internal/modules/cjs/loader.js:620:12)
at Module.require (internal/modules/cjs/loader.js:723:19)
at require (internal/modules/cjs/helpers.js:14:16)
at Object.<anonymous> (/app/config/auth.js:6:18)
at Module._compile (internal/modules/cjs/loader.js:816:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
at Module.load (internal/modules/cjs/loader.js:685:32)
at Function.Module._load (internal/modules/cjs/loader.js:620:12)
at Module.require (internal/modules/cjs/loader.js:723:19)
at require (internal/modules/cjs/helpers.js:14:16)
at Object.<anonymous> (/app/config/passport.js:8:18)
at Module._compile (internal/modules/cjs/loader.js:816:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)```
Was able to fix it by downloading an older version of dateformat. Nothing wrong with my code on the question its a simple problem with the library not the code come on.
Here I could make it work by using another version of this package,was working in the version 4.6.3, so I did:
npm i dateformat#4.6.3
Im running some code, and when I do npm start I get this error:
throw new TypeError('Router.use() requires a middleware function but got a ' + gettype(fn))
^
TypeError: Router.use() requires a middleware function but got a Object at Function.use (/bustabit-webserver/node_modules/express/lib/router/index.js:458:13)
at Function.<anonymous> (/bustabit- webserver/node_modules/express/lib/application.js:220:21)
at Array.forEach (<anonymous>)
at Function.use (/bustabit- webserver/node_modules/express/lib/application.js:217:7)
at Object.<anonymous> (/bustabit-webserver/server/index.js:93:9)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
Line 92 of server/index.js is
app.use('/client_old', express.static(path.join(__dirname, '../client_old'), { maxAge: twoWeeksInSeconds * 1000 }));
Here is my stack trace when attempting to launch my api side of my react - web app.
I have ran into this error multiple times but never seem to be able to fix it when it comes up again!
/Users/joshua_paulsen/Desktop/Jump-In-Final/api/node_modules/pouchdb-core/lib/index.js:1285
throw new Error('Invalid Adapter: ' + opts.adapter);
^
Error: Invalid Adapter: undefined
at new PouchDB (/Users/joshua_paulsen/Desktop/Jump-In-Final/api/node_modules/pouchdb-core/lib/index.js:1285:11)
at Object.<anonymous> (/Users/joshua_paulsen/Desktop/Jump-In-Final/api/dal.js:18:12)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/Users/joshua_paulsen/Desktop/Jump-In-Final/api/routes/workouts/index.js:8:5)
I had my db defined like this - const db = new PouchDB(
${process.env.COUCH_HOSTNAME}${process.env.COUCH_DBNAME}
)
the fix ended up being changing it to this.
var pouch = new PouchDB(${process.env.COUCH_DBNAME}, { adapter: "http" })
I'm just trying to test Hapi.js and, whatever I code, I got this error :
node_modules/hapi/lib/server.js:145
Items.serial(this.connections, (connectionItem, next) => {
^
SyntaxError: missing ) after argument list
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:413:25)
at Object.Module._extensions..js (module.js:448:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/gilles/exo1/node_modules/hapi/lib/index.js:5:16)
at Module._compile (module.js:430:26)
at Object.Module._extensions..js (module.js:448:10)
Where does come form this syntax ...() => {... to make a function ?
What I did bad to use Hapi ?
Thank you very much
The syntax is called Arrow function. You use hapi 10 or later which requires node 4+, but you have an older version of node which doesn't support arrow functions yet. The solution is to upgrade your node version to 4 or 5.
node is crashing at the following line:
var tcp = require('tcp'),
error text:
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module 'tcp'
at Function._resolveFilename (module.js:334:11)
at Function._load (module.js:279:25)
at Module.require (module.js:357:17)
at require (module.js:368:17)
at Object.<anonymous> (C:\Program Files\nodejs\websocket\websocket.js:11:11)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Module.require (module.js:357:17)
What is the problem? I found the source on the Internet, and the author, and the visitors also can run it...
Try require('net') instead:
$ node
> var tcp = require('tcp');
The 'tcp' module is now called 'net'. Otherwise it should have a similar interface.
> var tcp = require('net');
> $
Others are able to run, may be because they are using Node module when 'tcp' was there...
Now its called 'net', but its all the same thing no need of checking..
If you want to cross check for your more information, here are the links:
1.http://nodejs.org/api/net.html
2.https://github.com/joyent/node/blob/master/lib/net.js