I have a project that I am working on that has:
backend done with ASP.NET MVC ( the web API)
frontend done with Angular-JS , Grunt and Node JS.
The question posed here for the team was:
Have a part of the page ( a menu, navbar for example) being controlled my ASP.MVC and the rest (content) to be generated/controlled by angular.
Would NodeJS be able to do this (frankenstein-ish) task?
The answer is YES.
A good starting example would be to take a look at yeoman generator-aspnetmvc
$ npm install -g yo //install yeoman
$ npm install -g generator-aspnetmvc //install generator-aspnetmvc from npm
$ mkdir YourProject
$ cd YourProject
$ yo aspnetmvc //initiate the generator
The project in this example should give you an idea about how your grunt file can be configured to work with MVC applications.
Related
I'm trying to install jquery-csv library
with visual studio in ubuntu for the first time
the instruction says that to install package I should run:
npm i jquery-csv
however whenever I tried it npm warns me that it can't find package.son:
is this something i'm expected to see in a normal package installation?
if not, please help me with some instructions
The error you're getting suggests you aren't using a Node.js project and don't have a package.json file.
If this is an existing browser-based project and you want to add the library, you can download jquery.csv.min.js from here: https://github.com/typeiii/jquery-csv/tree/master/src , and add a client-side (browser) reference in your HTML file as shown on the readme:
<script src="jquery.csv.min.js"></script>
If you're working on a new Node.js project, the first step is to run npm init, see npm init - create a package.json file
I am working on a Front End project in Javascript (NPM, Webpack and Babel). I work on Mac all the time but I am having some issues when cloning the project in my PC Windows 10 machine.
It is building properly if I put the project in any directory but when I put the project in the directory where it should be located, Babel doesn't compile the project as expected.
The reason the project should be located there is because I am integrating it with some other tools (Bamboo - Continuous Integration).
npm run build
My builds script is:
"build": npm run clean && cross-env NODE_ENV=production webpack --env.prod=true
ERROR in ./index.js
Module parse failed: C:\opt\bamboo-home\xml-data\build-dir\STA-DEV-
JOB1\node_modules\babel-loader\lib\index.js!C:\opt\bamboo-home\xml-
data\build-dir\STA-DEV-JOB1\src\index.js Unexpected token (24:8)
You may need an appropriate loader to handle this file type.
| const render = (Component, target) => {
| ReactDOM.render(
| <Provider store={store}>
| <AppContainer>
| <Component/>
Does nodeJS or NPM or Webpack or Babel need specific permission over the directories they work on ?
Any help would be appreciated. I am lossing hair here.
Am glad you are using window 10. Use the bash shell on windows 10 to run the command npm run build.
follow this link to learn how you can cd to the directory from the bash shell
I had the same problem, then i found that i need shell bash, so follow the bellow steps:
install Git
go to project folder and right click to access context menu
from there run Git bash here
run the command: npm run build / yarn build
mine working perfectly with this solution.
We have a .NET Core project which uses Angular2 as frontend client. This frontend is located in our solution in a Frontend directory.
This frontend contains the package.json and angular-cli.json to isolate all that fron the rest of the .NET project. On ng build, Angular2 compiled files are sent to ../wwwroot directory.
Our project structure:
We want, when someone checkout the project AND on publish (on Azure) to be able to call these actions:
npm install -g angular-cli
cd Frontend && npm install && ng build --prod
How to achieve this in the project.json .NET Core file?
I tried for example, targetting a deployement on Azure, to set this up:
"prepublish": [ "npm install -g angular-cli" ],
"postpublish": [ "cd Frontend && npm install && ng build --prod", "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
But it breaks the deploy. Are both the prepublish and postbublish (with cd Frontend and subsequent commands) valid?
And how to make VisualStudio do the same thing when the people checking out the git repo and hit build?
In general, you may use any tasks runner (gulp, npm tasks, etc) and in postpublish step (or other step like prebuild) just execute appropriate tasks.
As alternative you could even do steps in opposite direction and call dotnet commands (build, deploy, ...) from your, lets say, npm task script. For example, you could look into this repo that is example of using ASP.NET Core and Angular2 with Webpack. They use those npm tasks as entry point of any actions like build, run or deploy:
The npm package.json configuration loads all the required packages for Angular 2 and Webpack. The Webpack packages are all added to the devDependencies. A “npm build” script and also a “npm buildProduction” are also configured, so that the client application can be built using Webpack from the cmd line using “npm build” or “npm buildProduction”.
I am running into a problem with import-jdl and I am not sure why it is not working. I am trying to generate entities for microservices application.
All I get is
The jdl is being imported.
but nothing else.
I used the sample https://jhipster.github.io/jdl-studio/ entity provided by JDL without any modification.
I have tried this in my Mac, Linux (Ubuntu), and Docker container but I get the same error.
Here are the versions of the software:
JHipster Generator: v3.3.0
npm : 3.9.2
yo : 1.8.3
Microservices Application
------- Application files will be generated in folder: /Users/anand/Desktop/jhexample
JHipster update available: 3.4.0 (current: 3.3.0) Run npm install
-g generator-jhipster to update. ______________________________________________________________________________
? (1/16) Which type of application would you like to create?
Microservice application
? (2/16) What is the base name of your application? jhexample
? (3/16) As you are running in a microservice architecture, on which
port would like your server to run? It should be unique to avoid port
conflicts. 8081
? (4/16) What is your default Java package name? com.anand
? (5/16) Which type of authentication would you like to use? JWT
authentication (stateless, with a token)
? (6/16) Which type of database would you like to use? MongoDB
? (7/16) Would you like to use Maven or Gradle for building the
backend? Maven
? (8/16) Would you like to enable internationalization support? No
? (9/16) Which testing frameworks would you like to use? (Press
to select)Gatling
...snip...
Server app generated successfully.
anand$ yo jhipster:import-jdl ./jhipster-jdl.jh
The jdl is being imported.
I've faced the same situation: The jdl is being imported but nothing is generated. As Vikas Joshi suggests try using jhipster-uml:
npm install -g jhipster-uml
jhipster-uml ./jhipster-jdl.jh -db mongodb
jhispter-uml usually returns more feedback. Anyway take into account that in MongoDB as noSQL database that it is, some options have no sense (e.g relations between entities).
if you are here because your jhipster import-jdl youfile.jdl doesn't create java code for entities but reportes the entities are imported, please try
jhipster import-jdl youfile.jdl --force
I was also struggling with the same error (for MySql i.s.o MongoDB). I used jhipster-uml i.s.o jhipster:import-jdl to create Entities and it worked for me. Hope it works with MongoDB as well. Don't exactly know why it does not work with import-jdl.
I've run on the same issue on my OSX. Currently I've managed to workaround this through a virtual-machine on linux(debian/ubuntu) using the jhipster-generator version 3.4.0 . Newer version will not create the entities even for me.
Please try to delete all stuff installed from bottom to top from the instalation guide here until nodejs part.
So yo will done the following:
npm uninstall -g generator-jhipster
npm uninstall -g gulp
npm uninstall -g bower
npm uninstall -g yo
Then follow steps to remove nodejs from here
After uninstalling start again installing nodejs and commponents as suggested on jhipster guide with the only difference at the last step:
npm install -g generator-jhipster#3.4.0
I've searched a bit but can't find an existing tool for this.
how to package node web-kit project for mac osx and what steps to follow to distribute this app to mac app store.
Thanks in advance.
You should have a look at the Node-webkit generator for Yeoman:
https://www.npmjs.org/package/generator-node-webkit
$ npm install -g yo
$ npm install -g generator-node-webkit
$ yo node-webkit
This will give you a folder with a set of tools to package and test your app for Windows, Mac and Linux.
Put your code on the app folder and run
grunt dist-mac
Next, sign up for a developer account at apple https://developer.apple.com/programs/mac/
And once you're done, grab your app from the dist folder and submit it to Apple.
The submission process may vary from the one for iOS, but you can find all the information on the Mac Dev Center.
Good luck!
Download webkit last version from :
https://github.com/rogerwang/node-webkit#downloads
create new Folder for you Application
put you HTML5 and Javascript Application in Side new Folder
create Application Manifest Format "package.json" with following
Docmentaction :
https://github.com/rogerwang/node-webkit/wiki/Manifest-format
install "Node webkit Builder " --> npm install node-webkit-builder -g
use Build to Get Application application for Paltform :
Usage: nwbuild [options] [path]
Options:
-p, --platforms Platforms to build, comma-sperated, can be: win32,win64,osx32,osx64,linux32,linux64 ['osx32', 'osx64', 'win32', 'win64']
-v, --version The nw version, eg. 0.8.4 [default: "latest"]
-r, --run Runs node-webkit for the current platform [default: false]
-o, --buildDir The build folder [default: "./build"]
-f, --forceDownload Force download of node-webkit [default: false]
--quiet Disables logging [default: false]