error installing/running Meteor with MySQL - javascript

I have installed Meteorite on my mac, and am trying to run the test program provided as a mysql project. When I use the command 'mrt', I get:
Stand back while Meteorite does its thing
Done installing smart packages
Ok, everything's ready. Here comes Meteor!
[[[[[ /Users/lfrey/Desktop/Thesis/test-meteor-sql ]]]]]
=> Errors prevented startup:
While building the application:
node_modules/meteor/app/lib/unsupported.html:1: Can't set DOCTYPE here. (Meteor sets for you)
node_modules/meteor/app/meteor/meteor.js:1:15: Unexpected token ILLEGAL
=> Your application has errors. Waiting for file change.
I have tried re-installing nom, meteor, meteorite, and mysql in various combinations and have not been able to eliminate the error. If I remove the command, then I get an error about invalid HTML syntax.

Your app might not be created properly. You have a node_modules directory in your application which you might have added with npm install.
Meteor does not install modules with npm install manually, it doesn't work because it parses files in the node_moules directory as part of your meteor app (in the wrong way - not as an npm module).
You have to make sure the package you use uses Npm.depends in your package's package.js. The standard Meteor-SQL package already does this for you so you don't have to worry about it.
Which SQL package did you use? As far as I can see none of them install anything with npm install nor do they have instructions to.
The simple fix to get your app working is to remove the modules you installed by deleting the node_modules directory in your app.

Related

I get an error when using the command "npm run start" for my react project

I am new to coding and would appreciate some help with this I get the following error when I try to run my react app: npm run start
Failed to compile.
Loading PostCSS "postcss-normalize" plugin failed: Cannot find module 'postcss-normalize'
Require stack:
/Users/abc/node_modules/postcss-loader/dist/utils.js
/Users/abc/node_modules/postcss-loader/dist/index.js
/Users/abc/node_modules/postcss-loader/dist/cjs.js
/Users/abc/node_modules/loader-runner/lib/loadLoader.js
/Users/abc/node_modules/loader-runner/lib/LoaderRunner.js
/Users/abc/node_modules/webpack/lib/NormalModule.js
/Users/abc/node_modules/webpack-manifest-plugin/dist/index.js
/Users/abc/node_modules/react-scripts/config/webpack.config.js
/Users/abc/node_modules/react-scripts/scripts/start.js
(#/Users/abc/node_modules/bootstrap/dist/css/bootstrap.css)
ERROR in ./node_modules/bootstrap/dist/css/bootstrap.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./node_modules/bootstrap/dist/css/bootstrap.css)
./node_modules/bootstrap/dist/css/bootstrap.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./node_modules/bootstrap/dist/css/bootstrap.css)
Module Error (from ./node_modules/postcss-loader/dist/cjs.js):
Loading PostCSS "postcss-normalize" plugin failed: Cannot find module 'postcss-normalize'
Require stack:
/Users/abc/node_modules/postcss-loader/dist/utils.js
/Users/abc/node_modules/postcss-loader/dist/index.js
/Users/abc/node_modules/postcss-loader/dist/cjs.js
/Users/abc/node_modules/loader-runner/lib/loadLoader.js
/Users/abc/node_modules/loader-runner/lib/LoaderRunner.js
/Users/abc/node_modules/webpack/lib/NormalModule.js
/Users/abc/node_modules/webpack-manifest-plugin/dist/index.js
/Users/abc/node_modules/react-scripts/config/webpack.config.js
/Users/abc/node_modules/react-scripts/scripts/start.js
(#/Users/abc/node_modules/bootstrap/dist/css/bootstrap.css)
Thank you so much
I've tried updating to the latest version of node and npm, however, that did not help. I've also verified my code several times as I'm mostly practicing along with a course. Thank you.
As it appears this error will temporarily get fixed by installing the latest version of Node.js.
So to fix this follow these steps:
Download and install the latest Node.js version (recommended for most users, which is 16.15.0 at this moment).
Delete your node_modules directory from your project. Then you can optionally clear npm cache with npm cache clean and verify it with npm cache verify.
Delete package-lock.json/yarn.lock file.
Reinstall all of the dependencies and create a new dependency tree using one of the following commands: npm i/npm install/yarn/yarn install.
Note1: If in any case, you use node-sass in React projects yet, it is recommended to use sass instead.
Note2: In some cases skipping step 1 will also work as expected, but I recommend upgrading the Node.js version if you do not have other dependencies to prevent that.
Note3: As #IvaniltonBezerra mentions in the comments, some app builds may throw errors, since upgrading Node.js to its latest version will upgrade the npm as well it may not compatible with your current dependency tree in production, so to prevent such a problem you have to use --legacy-peer-deps to restore the old behaviour of the old dependencies.
Update
This is now seem to be permanently solved in PostCSS Preset Env and following the above steps with skipping step 1 will also solve the problem.

Change node.js project name after installing Express.js

I'm new to node.js and just went through basic tutorials and now ready to set my project with Express.js installed as well.
I'm just wondering what happens if I change my project name to something else now that I've got the framework in place. Can I simply just rename the project directory or do I need some npm package to refactor it properly?
With Ruby on Rails, there is a gem for this purpose and wonder if it's the same for node.js project.
Can I simply just rename the project directory?
Yes.
Express is just a library.
Express-generator (which proviedes "express" command line) is a tool (not actually a framework) to easily build a basic project layout with express, jade and a few other common packages.
Out of the box you can run it by executing ./bin/www (or node bin/www).
Until now, project name doesn't care so far except for if you put it in some template, database register, etc...
Sure you will use some version control system (vcs) like git or subversion and, if you don't want to publish it as npm module, you doesn't need nothing more.
But, even if you doesn't plan to publish it at npm, it is a wonderful tool to manage your project packaging.
If you did it, (by executing "npm init"), then you can take advantadge of some facilities like:
Launch your project with 'npm start'.
Install modules with 'npm --save module_name'.
DON'T track node_modules directory in your vcs.
Get fresh node_modules directory for your current node version with 'npm install'
etc...
All this magic is thanks to a file named 'package.json'.
This file was generated when you did (if you did it) 'npm init' and contains a package name and a version number.
If you doesn't plan to publish your package it also doesn't care so much. But it is a bit more polite to update it accordingly if you rename your project.

How to install/run a node module from Windows cmd

Very big 'node' noob here. Just trying to get the lay of the land. I've installed node and the npm package manager based the excellent instructions found here. I can verify I have everything (node-wise) installed okay - with a user variable set to PATH =C:\Users\Dude\AppData\Roaming\npm
Using npm I installed
npm install -g query-overpass
npm install -g geojsonio
And verified that both had .cmd files and stuff show up here:
C:\Users\Dude\AppData\Roaming\npm
then from the cmd I put in the example
echo '[out:json];node(57.7,11.9,57.8,12.0)[amenity=bar];out;' | query-overpass
and got
{ message: 'Request failed: HTTP 400', statusCode: 400 }
Is there something I am missing here regarding installing node modules and how to run them (in Windows)? Is a .js file calling the modules what is required?
What makes you think there is an issue with your node modules? The error message is very clearly an HTTP error message, indicating a problem with the query you're making. Your modules are installed fine.
I don't know what your modules do, but you should try different parameters and contact the person that wrote them to indicate that their example no longer works.

Error while attempting to add packages in Meteor

So I am very new to Meteor, and I was sifting through some example apps and open source projects when I came across this simple chat application:
(https://github.com/BenderV/simplechat)
I wanted to download the project, run it on my local server, and mess around with the code to learn more about what does what, and how to use the Meteor framework. I simply downloaded the .zip file from github and tried to run it (using the meteor in my terminal. However I got the following error when I ran the application locally in my browser:
Your app is crashing. Here's the latest log.
=> Errors prevented startup:
While building the application:
error: no such package: 'accounts-guest'
error: no such package: 'user-status'
error: no such package: 'accounts-testing'
error: no such package: 'fontawesome4'
error: no such package: 'iron-router'
error: no such package: 'bootstrap-3'
error: no such package: 'fast-render'
error: no such package: 'jquery-titlealert'
error: no such package: 'related'
=> Your application has errors. Waiting for file change.
I can (obviously) infer from the nature of the log that the error that I am experiencing is because I don't have the correct packages installed (the one that are listed, obviously).
So keeping this in mind, I researched how to add packages to meteor (using instructions I found on Atmosphere JS pages of the respective packages). However, when I entered the command that was provided by Atmosphere into my terminal (for example for, 'accounts-guest' package I entered: meteor add artwells:accounts-guest). Unfortunately doing this did not work, and I was given something like the following error in the terminal: artwells:accounts-guest: no such package
I have no idea what to do, the packages will not install so I can not try this code. I come from experience with Rails, and in Rails if you needed to install "gems" (pretty much the same thing as packages in Meteor) you could just enter bundle install into the terminal to download and install undefined packages. Is there something like this in Meteor? I have heard of something called Meteorite, but am unsure what it is and how to use it.
Anyways I really would appreciate any help in getting me past this minor roadblock on my way to learning Meteor!
Thank you
That's an older project which use the old packaging system 'meteorite' = 'mrt' on the command line.
I suggest you try a newer example, Meteor ships with a few. Once you have Meteor installed you can create an example app by typing one of the following commands :
meteor create --example leaderboard
meteor create --example todos
meteor create --example localmarket
And yes, there is a very similar mechanism to the gems commands you are accustomed to. Simply running a project 'meteor' should download its dependencies. Also you can run 'meteor update' if you want to update to the latest versions for your project.
Last August there was a major update to the meteor package management system, you can read more about it here : https://www.meteor.com/blog/2014/08/26/meteor-090-new-packaging-system
So, for any examples you'd like to check out, try and get a recent one, from meteor 1.0. In newer versions of meteor those instructions on Atmosphere should work out fine for you.
You can see what version of meteor a project is running by looking at this file ".meteor/release" inside a meteor project :
https://github.com/BenderV/simplechat/blob/master/.meteor/release
so you can see that one is old.
good luck!

How to run node.js applications locally for development

I am new to node.js,today I joined in another team they are working with node.js,backbone.js,marionette.js and sqlserver.I have an idea about backbone,Marionette but I never work on node.js.They asked me to clone the git repository,As per their suggestion I installed node.js.
After cloning the repository,I got the files just in the following way.
I opened node_modules folder,It has nearly 10 sub-folders are there.
node-sqlserver doesn't have any files inside.might be because of that I am getting the following error while server running time.
I ran the server with the following command
node server.js local
getting the following error
I don't know,why I am getting.can anyone help me.
Thanks.
You need to install all the dependent modules through npm install, In your case, you need to install node-sqlserver.
npm install node-sqlserver
Generally your source code will be having a package.json. This file specifies all the
dependent modules required to run the application, but here this file is missing.

Categories