After setting up node bower grunt and mean I run mean init myApp which prepares me a new project. At that point I go into the app and run
npm install
After my project is installed I can run the app with no problems and everything looks great. But the amount of files and folders is a bit overwhelming. I have searched for a tutorial explaining the file paths but can't find one that matches my current build after following those commands right off of the mean.io website.
$ sudo npm install -g mean-cli
$ mean init yourNewApp
Someone please provide me with some documentation to read through to understand what's being installed following those commands and how to weed through it to understand how to start working with mean.io
The file structure is int he picture below.
Config is for env-based and global configuration.
Gulp is the gulp scripts for running \ updating \ minifying
Logs contain the application's logs
node_modules contain npm dependencies (standard)
Packages contain core and custom packages
Tests contain the test configuration files
Tools contain general scripts like npm's postinstall actions (for example, propagating bower install to all packages)
The documentation describes the folder structure for packages (which is almost the only interesting folder in terms of functionality development):
Also, John Webb has a couple of useful mean.io video tutorials which might help you find your way around mean.io:
Getting Started
Customization
Related
this is the first this ever happened to me.
I am trying to install a documentation generator (docma) and for some reason I follow everything they say in the docs and can't execute 'docma' or 'docma serve', it says it's not recognized as a cmdlet, tried it on my Linux machine and it also isn't recognized as a command, so there's no way for me to serve my documentation and the developer stopped supporting that years ago.
Thanks in advance
EDIT: I should add that I don't get a node_modules folder
If you don't have a package.json file for your project, create one:
npm init
(If you don't care about what the contents of the package.json file are, then you can accept all the defaults with npm init -y rather than answer the questions the command will ask you.)
The documentation says to install docma in a project like this:
npm i docma -D
Do that. That will create a node_modules directory if you don't already have one.
From there, all the commands in the docma documentation can be executed from the command line if you precede them with npx. So where it says docma, you can use npx docma. And where it says docma serve, you can use npx docma serve. (You will need to be in your project directory for this to work!)
Another solution would be to install docma globally (npm i docma -g) but that has its own risks and complications (such as requiring elevated privileges in some situations). What I've described above is (IMO) safer and better.
I have installed Node JS and then imported an existing work project in Visual Studio Code. After that I ran npm install in the project folder, then run npm start and the app comes up fine. However, if I run an ng command I get an error telling me "ng is not valid command", even though the Angular CLI is in the modules folder.
I tried manually installing Angular CLI globally and set system path to point to the npm folder, and then the ng command works fine. What I don't understand is why do I need to install CLI globally if I just want to run that command within the project where the module is already present?
As a general rule then you will need to install globally any commands you wish to use (without NPX). This isn't really a restriction of NPM so much as it is a fundamental way in which command line programs work. The OS will only look in fixed predefined locations set in PATH. This applies to any Node based tool such as grunt or ng or whatever.
(While some systems do look for executables relative to the current working directory, or can be configured to, it's generally not a good or reliable method and NPM doesn't rely on this behaviour).
For something like the Angular CLI then installing it globally should be fine and is what many people will do. As a general rule if it is a command you want to run, rather than a dependency for a project, you can consider installing it globally. You'll notice that on the Angular CLI page the example does exactly that.
In many cases however you might want to run a command from a local project. Perhaps for a build script or something else where you want to keep it isolated. In that case you instead prefix your command with npx which will look inside the local project for commands.
I'm very new to Node Package Manager and also Vue, and I'm trying to understand what exactly is going on with using the Vue CLI.
The vue.js website has this as instructions for running the official Vue CLI:
I have a few questions about this:
Does npm install --global vue-cli need to be executed only once on a machine, or once on a directory, or once per new project you're starting? In other words, once it's on your computer, is that the last time you need to run that command, or do you need to execute this command every single new project you start?
Once a new project is initiated, are local copies of the newest version of vue (and vue-router, if selected) installed?
If I finish this project and want to deploy it, how do I then port this over to a production server?
Once in a machine, except for the rare cases where one is isolating one's npm install (such as by using nodeenv or inside a container); that's what the global option is for.
After running npm install, yes.
Running npm run build and copying the contents of the resulting dist directory to the production machine (often within a /var/www directory or similar). This can be automated further in many ways.
I need help trying to install a node.js package from Github using the npm command prompt. It's an adaptive grid Jquery plugin called Masonjs: https://github.com/DrewDahlman/Mason.
It's my first time to use node.js, hence the difficulty understanding the setup instructions. I've CD'd to the project folder and run the 'install npm' and 'install bower' steps successfully, but I don't understand how to complete the remaining steps: running and building Gulp (is building necessary?).
Any help would be very much appreciated.
If you just want to use masonjs library in your project, you don't need to run gulp commands for running and building. Just cd into your project directory where you have initialized npm/bower and run npm install masonjs / bower install masonjs.
The next step would be to add the mason.js file in your index page. Now there would be different folder structure in which this mason.js file is present.
In case of npm module the path would be {your-project-directory}/node_modules/masonjs/lib
And in case of bower components the path would be {your-project-directory}/bower_components/MasonJS/dist
Now just use this library and it will work perfectly.
I'm trying to deploy a grunt based app to CC. I would like to deploy the dist version of the app, which is generated with the grunt build task. Right now, what I've done is to move my grunt devDependencies to dependencies and use the NPM postinstall hook to run the grunt build task. This way once updated NPM dependencies CC runs the task.
But, I've two issues with this approach:
1) compass is not working
2) it just doesn't feel correct to move all my grunt dependencies to dependencies. The first issue I think that I could fix it using another SCSS grunt module.
Any other alternative approach? Preferably I don't want to save my dist builds in the repository.
Can you please explain the situation a little bit more?
Normally I would follow the following steps
Local
Do the npm install
Do the grunt build
push to the cloud
Server
Set the environment as production(assuming that all your files check for the environment and load files accordingly)