mean stack missing folders - node.js

Installing a mean stack:
$ sudo npm install -g meanio
$ mean init yourNewApp
Checking file structure:
$ ls
AUTHORS Procfile config packages
Gruntfile.js README.md karma.conf.js server.js
LICENSE bower.json package.json
I am missing the correct file structure even though the app "works". Everything should be installed correctly. Where is public and the server folder?
These folders are also missing if I clone any other mean stack project from github.

I had a same problem because I am beginner, but it seems that MEAN Stack file structure has been changed few weeks ago. Quote from Mean.io docs says:
'From v0.4.0 all the application code has been integrated into a number of packages. Each package uses MVC on the server and client. Below is the overall file structure as well as the package file structure'
Source: http://mean.io/#!/docs
This mean.io file structure is organised in packages and each package has own MVC for server/client sides folders. Also, please take a look on mean.io blog site where there is article about package types: http://blog.mean.io/2014/06/extending-mean-io/

If you are windows user and you try to follow mean.io website instructions, you probably will be confused how to install all the stuff in order to see the application lunched in your browser and probably you can't manage to have all the sources in your project. Follow their video from homepage or DO THIS:
Install Git from http://msysgit.github.io/ and then in then fallow
the instructions from here
http://www.computerhope.com/issues/ch000549.htm in order to add your
“git” var path;
Install node.js from http://nodejs.org/;
Install MongoDB from http://www.mongodb.org/. Create in your "C:\" the "data" directory and inside of "data" create "db" directory. Add like step one a new PATH var but this time for mongodb. For this you should find out your mongodb root in the window system (ex: C:\Program Files\MongoDB 2.6 Standard\bin).
Run in cmd: npm install -g meanio ;
Run in cmd: mean init myApp;
Go into myApp folder using cmd and there run: npm install;
Run in new cmd window in C:\ : mongod;
Run in new cmd window but this time in your myApp location: grunt. If you obtain an error saying that grunt is not recognized then run this comand line "npm install -g grunt-cli";
Go in browser and type http://localhost:3000/.
Hope this will be useful for someone new like me in this area.

In Mean.IO total project is divided into number of modules and these modules are known as package. these packages mostly independent from each other. and each package contains public and private folder separately. for more see the mean documentation.

Try installing meanjs. It's a fork from the mean.io. Many developers have shifted to meanjs as it's more stable and from the same guy Amos Haviv who started mean.io.

Related

Problems with getting started with node.js and puppeteer

I am quite new to programming and today decided to attempt and create a node.js and puppeteer project with the purpose of scraping website into a .txt file. I ran into issues straight away since for the most part I have no idea what I'm doing. After installing node.js and puppeteer, I was guided by some videos and articles I found to create my first project. In the command prompt using mkdir and later cd I was able to create and access the new directory, but I started running into problems with npm init. It only places the file package.json in the repository, but there isn't a package-lock or node_modules file anywhere. No idea what they do but thought this was a problem. When I open cmd and try to run the app by typing node app.js it returns Error: Cannot find module 'C:\Users\emili\app.js' along with some other gobble. What should I do, to be able to run the simple application I wrote?
It seems that you are missing some key knowledge on how NodeJS works, but in order to fix your issue (for now), you will need to take a few steps.
First, in your working directory (where the package.json is), you'll need to install your modules.
Run npm install puppeteer. This will do two things, create the node_modules folder and create the package-lock.json file.
Create a file named app.js (either manually or by running the command touch app.js) in your working directory, and put the following content inside of it:
console.log('Hello, World!');
Save the changes to app.js and then run node app.js in your terminal. You should see Hello, World! output to the terminal.
The reason npm install puppeteer created the node_modules folder and the package-lock.json file is because they weren't needed beforehand.
When you run npm install PACKAGE_NAME, you're installing a module (otherwise known as a package), thus it creates the node_modules folder so that it will have a place to put the module so that your code can access it. It also creates the package-lock.json file, which is used to track the module versions inside of your project.
With this information, I request you go back to the tutorial you were originally following and try going through it again and attempting to understand each of the core concepts before writing any real code.

Liferay 7 Theme-Generator: Setting parent theme (baseTheme)

I have used the theme-generator to create a fresh theme.
Now I've created a second theme in the same directory and tried to set it's base/parent theme using gulp extend as explained on these pages:
https://github.com/liferay/liferay-theme-tasks
https://dev.liferay.com/de/develop/reference/-/knowledge_base/7-0/theme-gulp-tasks
After running the command and choosing option 1) to extend the Base Theme , I get the following options:
Styled
Unstyled
Search globally installed npm modules (development purposes only)
Search npm registry (published modules)
No matter if I choose 3) or 4) I cannot find the theme package.
Do I really have to publish the theme to npm to be able to find it?
Following this explanation I could achieve it using npm link:
npm link
Excerpt:
npm link: symbolic links to the rescue Fortunately npm provides a tool
to avoid this tedium. And it's easy to use. But there's a catch.
Here's how it's supposed to work:
cd to src/appy
Run "npm link". This creates a symbolic link from a global folder to the src/appy folder.
cd to src/mysite
Run "npm link appy". This links "node_modules/appy" in this particular project to the global folder, so that "require" calls
looking for appy wind up loading it from your development folder,
src/appy.
Mission accomplished... almost. If you installed Node in a typical
way, using MacPorts or Ubuntu's apt-get, then npm's "global" folders
are probably in a location shared system-wide, like /opt/local/npm or
/usr/lib/npm. And this is not good, because it means those "npm link"
commands are going to fail unless you run them as root.
EDIT: I was wrong to make a npm package out of it when you can also just require it locally. Even relative paths work. Example:
"dependencies": {
"my-liferay-theme": "file:../My-Liferay-theme",
}

DocuSign Objective C REST API setup

I'm trying to set up an Objective C XCode project to test DocuSign API for request a signature via email recipe. These are the steps I've been through now.
Downloaded ObjC client
Copied code from GitHub (docusign-rest-recipes/core_recipes/CoreRecipes.m)
Created a new xcode project with ObjC client and GitHub code.
I now get JSONModel/JSONModel.h file not found.
Please help me on this.
Try installing through Cocoapods if you're having issues with a manual copy. There are instructions listed in the README at the root level of the repo:
https://github.com/docusign/docusign-objc-client
CocoaPods Install
Create a podfile, run pod install, then use the .xcworkspace project file moving forward. To use the clients in this manner, do the following:
At the command line run the following RubyGems command to install cocoapods (note: this might require sudo):
$ gem install cocoapods
Create a file in your root project directory called Podfile with the following content. Replace the two references to PROJECT below with your unique project name:
$ pod 'DocuSignESign', '~> 2.0.0'
Run the following command in the same directory as your Podfile:
$ pod install
Once you are done installing, close Xcode and open the newly created .xcworkspace project file. Make sure you use this work space going forward!

yo meanjs not creating app folder

I am a beginner to mean.
I have followed the following steps to create meanjs app :
installed node v0.12.7
npm install -g bower
npm install -g grunt-cli
npm install -g yo
npm install -g generator-meanjs
cd C:\Users\SHIVAM\Desktop\MyApp
yo meanjs
MyApp folder containing mean directory created
Error occured on yo meanjs 1
Please provide a solution . I am struck at the first phase. I need to get started as sson as possible .
Version 0.4.* has different folder structure. The tutorial you are following is probably using earlier version of meanjs. You can find the new structure here-http://www.bossable.com/954/version-0-4-0/ She has compared the structure with the older one. I was going through the same problem. Follow these tutorials, it will be of great help.
The following directories have been changed in the 0.4.* versions of Meanjs; 0.4.2 is still unstable. 0.4.0 and 0.4.1 is recommended for beginners to get on MEAN.
-New files have been added
1) gulpfile.js-Gulp is relatively faster than grunt because gulp focuses on code rather than cofiguration. It uses node.js’ streams, and executes faster, since it does not open/close files, or create intermediary copies all the time. The lack of any up-front configuration, especially, specifying a source and destination is noticed immediately in this file.
2) protractor.conf.js-Support file for end-to-end testing in angularjs applications. (Pretty Neat.)
The app folder is removed, which is the major concern for the noobs trying their hands on MEANjs following the older tutorials. Controllers,views, models are now moved into a separate folder called modules which was previously in the public folder.
You can explore modules/core/server and modules/user/server of your project
Addition of client, server and test in modules/core and modules/user folder. All the client side angular will now be in the modules/core/client making it easier to access all services and directives of different modules of the application at one place. And all the backend or server-side files goes to modules/core/server.
public/application.js and public/config.js are now config.js and init.js in modules/core/client/app folder.
config folder is split and new folders assets and lib are added.
The previous env folder have been split into env and assets. All the references, mongodb port, session keys goes to the environment(env) whereas new libraries we are defining into our project goes to assets. For instance new css, sass or less reference will be defined into asset/default.js. config.js and init.js are merged into one file config/config.js.
lib contains express.js, mongoose.js and socket.io.js.
node_modules is pretty much exactly the same as the previous versions of meanjs.
These are the major changes in the folder structure. New models and controllers are added into the modules/users/server according to your application, just so you don't get lost while developing your project.

Is it possible to have a node_modules directory shared between projects

I have a project setup that is as follows:
workspace
└cache
└node_modules
└gulp (and gulp-plugins, express etc.)
└nodejs
└node.exe
└project1
└gulpfile.js
└project2
└gulpfile.js
Now I want to execute the gulpfile in the project directories:
set NODE_PATH='C:\workspace\cache\node_modules\'
cd C:\workspace\project1\
C:\workspace\nodejs\node.exe C:\workspace\cache\node_modules\gulp\bin\gulp.js watch
and I get the following output:
[12:06:04] Local gulp not found in C:\workspace\project1
[12:06:04] Try running: npm install gulp
In both project folders the gulpfile is similar and uses a similar set of plugins. I'd really like to have the dependencies only once (because potentially I have up to 25 projects sharing the same node_modules).
Is this setup possible, or does the seperate project directories need to have their own node_modules folders?
Gulp requires you to have both a global installation as well as a local one. So you need to have your Gulp relatively to your Gulpfile. If your package.json would be located in workspace and your node_modules would be in workspace/node_modules everything would work fine because of Node's search tree, but if you can't move them, the only way to make it work is to "fake" the node_modules folder.
You can do this by creating a symbolic link.
Here's on Unix/Linux/Mac:
ln -s ../cache/node_modules node_modules
Here's on Windows
mklink /D node_modules ../cache/node_modules
(the latter one might work different, I'm not on a Win machine)
You could also try pkglink
From description:
Space saving Node.js package hard linker. pkglink locates common JavaScript/Node.js packages from your node_modules directories and hard links the package files so they share disk space.
Edit: ddprt
On Windows
mklink /D node_modules "C:/fullPATH/cache/node_modules"
you could always use the '-g' parameter with npm install 'package-name', so as to make the module available globally to access across different projects.
See the following links
what does the "-g" flag do in the command "npm install -g <something>"?
How do I install a module globally using npm?
https://docs.npmjs.com/files/folders
Packages are dropped into the node_modules folder under the prefix. When installing locally, this means that you can require("packagename") to load its main module, or require("packagename/lib/path/to/sub/module") to load other modules.
Global installs on Unix systems go to {prefix}/lib/node_modules.
Global installs on Windows go to {prefix}/node_modules (that is, no
lib folder.)
Scoped packages are installed the same way, except they are grouped
together in a sub-folder of the relevant node_modules folder with the
name of that scope prefix by the # symbol, e.g. npm install
#myorg/package would place the package in
{prefix}/node_modules/#myorg/package.

Resources