Using the Meteor.settings feature - javascript

Meteor recently added a brand new Meteor.settings object starting v0.5.4. And in an extremely annoying manner, didn't properly explain, with example, in their documentation how to setup settings.
In my app, I have a text file (in the root) called "settings.json":
{
"initURL" : "http://localhost:60326/"
}
But when I try to start the app using meteor --settings settings.json, I get the following error:
undefined:1
{
^
SyntaxError: Unexpected token 
at Object.parse (native)
at Object.exports.getSettings (C:\Program Files (x86)\Meteor\app\meteor\run.
js:537:10)
at start_server (C:\Program Files (x86)\Meteor\app\meteor\run.js:239:28)
at exports.run.restart_server (C:\Program Files (x86)\Meteor\app\meteor\run.
js:655:21)
at C:\Program Files (x86)\Meteor\app\meteor\run.js:726:9
at Socket.exports.launch_mongo (C:\Program Files (x86)\Meteor\app\lib\mongo_
runner.js:187:9)
at Socket.EventEmitter.emit (events.js:93:17)
at Pipe.onread (net.js:391:31)
Does anyone have any idea what could be wrong with my Meteor app's settings?

You have hidden characters in your settings.json, probably due to a copy-paste.
Your best bet is to delete the file and write it manually, or to get a text editor that can view all these unicode characters and remove them.

Related

Next build fails only on my machine with `Generating static pages (0/6)TypeError: n.replaceAll is not a function`

I am trying to build my Next.js project, but I am getting the error Generating static pages (0/6)TypeError: n.replaceAll is not a function at a file in my node_modules folder.
Steps I have taken to try to identify where the problem is coming from:
(In the following when I say install&build I mean yarn install --frozen-lockfile, then next build
delete node_modules and .next folder, insall&build -> fails
clone the repo in a new folder and install&build -> fails
Run this as a github action on github -> succeeds
Run this as a github action on my machine using this library: https://github.com/nektos/act (that uses docker) -> succeeds
do step 1 on my colleagues machine -> succeeds
do step 2 on my colleagues machine -> succeds
The full error is:
Error occurred prerendering page "/404". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: n.replaceAll is not a function
at file:///home/sev/dev/frontend/node_modules/connectkit/build/index.es.js:682:37384
at Array.forEach (<anonymous>)
at rn (file:///home/sev/dev/frontend/node_modules/connectkit/build/index.es.js:682:37367)
at file:///home/sev/dev/frontend/node_modules/connectkit/build/index.es.js:682:37304
at Array.map (<anonymous>)
at tn (file:///home/sev/dev/frontend/node_modules/connectkit/build/index.es.js:682:37270)
at kn (file:///home/sev/dev/frontend/node_modules/connectkit/build/index.es.js:682:42706)
at Wc (/home/sev/dev/frontend/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
at Zc (/home/sev/dev/frontend/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
at Z (/home/sev/dev/frontend/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
You get this error because String.prototype.replaceAll() is only supported from Node v15.0.0:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll#browser_compatibility
You will need to update your version of Node to at least this version.
I hope this helps to resolve your issue.

Error when trying to run any Cypress test

I've installed Cypress according to the cypress docs. After opening Cypress and selecting a test to run, I instantly get the following error:
**Title:** Error running plugin
Message: The following error was thrown by a plugin. We stopped running your tests because a plugin crashed. Please check your plugins file (C:\Users\metin\Desktop\Programming\School\Typescript\From JS to TS\cypress\plugins\index.js)
Stack trace:
Error: The following error was thrown by a plugin. We stopped running your tests because a plugin crashed. Please check your plugins file (`C:\Users\metin\Desktop\Programming\School\Typescript\From JS to TS\cypress\plugins\index.js`)
at Object.get (C:\Users\metin\AppData\Local\Cypress\Cache\9.1.0\Cypress\resources\app\packages\server\lib\errors.js:1043:15)
at EventEmitter.handleError (C:\Users\metin\AppData\Local\Cypress\Cache\9.1.0\Cypress\resources\app\packages\server\lib\plugins\index.js:189:20)
at EventEmitter.emit (node:events:394:28)
at ChildProcess.<anonymous> (C:\Users\metin\AppData\Local\Cypress\Cache\9.1.0\Cypress\resources\app\packages\server\lib\plugins\util.js:19:22)
at ChildProcess.emit (node:events:394:28)
at emit (node:internal/child_process:920:12)
at processTicksAndRejections (node:internal/process/task_queues:84:21)
I've been googling for a few hours and I'm looking for help on how to resolve this issue!
Uninstall Nodejs
Download the Nodejs (Recommended For Most Users) version from the link:
https://nodejs.org/en/
Install the downloaded Nodejs
I had the same issues
in my case, this issue was related to my bitbucket.yml.file, I changed: max-time:(set time for running your tests) in my job, and everything works fine
If you're using Cucumber then review your step files in search of misspelling keywords or case sensitive typos like wHEN or thEn

Browserify builds stopped all return error on process.versions.node

I have been seeing a recurring error with my browserify builds. It seems to be affecting all of my builds (I have old state that preserves them, but when I clone onto a new machine I get the error). I am using the the babelify transform as well. My specific command is:
browserify <file> -t babelify -o <output>
Each build completes successfully but I get the same error when in the browser:
Uncaught TypeError: Cannot read property 'split' of undefined
at Object.<anonymous> (core.js:1)
at Object.319../core.json (core.js:23)
at s (_prelude.js:1)
at _prelude.js:1
at Object.315../lib/async (index.js:1)
at s (_prelude.js:1)
at _prelude.js:1
at Object.<anonymous> (run-filter.js:6)
at Object.146._process (run-filter.js:44)
at s (_prelude.js:1)
The specific line in core.js is:
var current = process.versions.node.split('.');
I have not been able to find any info on this error anywhere as problems with split not being defined return a variety of errors not related to browserify or any other tech I am using.
I had the same issue. This command fixed it: npm install resolve
That error is occurring in the resolve module. This commit uses a node-specific version check, breaking the code in the browser environment. You must have the old version of resolve on your existing machine that doesn't have this bug. I've created this issue to track the bug's resolution.

node js web app on AWS failed to lookup failed to lookup view "pages/home" in views directory "/var/app/views"

I'm trying to put my simple node js web app on AWS EB but it seems like it has a problem with path. I'm running windows on my machine and it works but when I deploy it on EB it gives me the following error
Error: Failed to lookup view "pages/home" in views directory "/var/app/views"
at EventEmitter.render (/var/app/current/node_modules/express/lib/application.js:579:17)
at ServerResponse.render (/var/app/current/node_modules/express/lib/response.js:961:7)
at null.<anonymous> (/var/app/current/controller/app.js:113:14)
at tryCatcher (/var/app/current/node_modules/bluebird/js/release/util.js:16:23)
at Promise.successAdapter [as _fulfillmentHandler0] (/var/app/current/node_modules/bluebird/js/release/nodeify.js:23:30)
at Promise._settlePromise (/var/app/current/node_modules/bluebird/js/release/promise.js:557:21)
at Promise._settlePromise0 (/var/app/current/node_modules/bluebird/js/release/promise.js:605:10)
at Promise._settlePromises (/var/app/current/node_modules/bluebird/js/release/promise.js:684:18)
at Async._drainQueue (/var/app/current/node_modules/bluebird/js/release/async.js:126:16)
at Async._drainQueues (/var/app/current/node_modules/bluebird/js/release/async.js:136:10)
at Immediate.Async.drainQueues [as _onImmediate] (/var/app/current/node_modules/bluebird/js/release/async.js:16:14)
at processImmediate [as _immediateCallback] (timers.js:383:17)
my code for path
var path = require('path');
var app = express();
app.use(express.static(path.resolve('../public')));
app.set('views',path.resolve('../views'));
app.set('view engine', 'ejs');
I'm assuming you're using the path module to resolve directory and file names (to avoid issues with the differences between Windows and linux filesystems).
It could be a file permissions or ownership issue. Check that the user under which the node process is running has read permissions on the relevant directories and files.
It could also be a path resolution issue. It looks like your app is in /var/app/current/, but you're trying to find files in /var/app/views/. Should work if that's how your app is structured, but it would be problematic if you intended to look for files in /var/app/current/views/.
I had similar issue, my problem is that I forget to zip the view sub directory in my root directory recursively, thus resulting in a empty view directory when deploy to AWS Elastic Beanstalk. So when packing your code you should use something like zip -r example.zip . .
Just concentrate on case sensitivity. Ensure that the filename passed on the render is exactly the same as the file on the server ...
eg.
res.render("Challenge",... having a view filename challenge.hbs... WILL FAIL
res.render("challenge",... having a view filename challenge.hbs... WILL PASS

Unable to preview / run angular.js project from codenvy

I developed an angular.js project on codenvy IDE on Javascript framework ( or is it platform). I am unable to preview the same.
I get the following error.
[ERROR] Failed to start application. : ====> /logs/stderr.log <==== node.js:134 throw e; // process.nextTick error, or 'error' event on first tick ^ Error: Cannot find module 'gulp' at Function._resolveFilename (module.js:326:11) at Function._load (module.js:271:25) at require (module.js:355:19) at Object.(/var/vcap.local/dea/apps/app-07zsn86eb8vspvg0-0-bf2638b3e702ededc5473a0c16608d37/app/gulpfile.js:1:74) at Module._compile (module.js:411:26) at Object..js (module.js:417:10) at Module.load (module.js:343:31) at Function._load (module.js:302:12) at Array. (module.js:430:10) at EventEmitter._tickCallback (node.js:126:26)
The console output says it cannot find Gulp, but my project certainly has gulp.js on the root folder. Also the project works perfectly fine when i preview this from a Webstorm editor - so i dont think there is an issue with the code per se..
Any help much appreciated
James
If your project is public, please, share it with Codenvy's factory feature. So everyone will be able to look what is wrong with the project. (You can access factory on left panel of the IDE)

Categories