Yeoman - generator-angular error at init app deployment - node.js

I have installed npm, Yeoman and got everything working, the webapp generator works like a charm. I want to get into angular development and therefore tested the generator-angular.
I did everything as stated in the readme file
npm install -g generator-angular
yo angular [app-name]
then
grunt
grunt serve
at grunt i got this error:
WARN [watcher]: Pattern "/home/user/angular/test/mock/*/.js" does not match any file.
INFO [Chrome 31.0.1650 (Linux)]: Connected on socket 3juFgfMcw5Pm88-cve27
Chrome 31.0.1650 (Linux) Controller: MainCtrl should attach a list of awesomeThings to the scope FAILED
Error: [$injector:modulerr] Failed to instantiate module testApp due to:
Error: [$injector:unpr] Unknown provider: $routeProvider

The main error - is with "unknown" $routeProvider.
Check if ngRoute module has been loaded.
Also check that you propely injected it to your testApp module.
It would be great if you could provide your testApp code.
Also I guess that you have an error with regex (no escape symbol)
/home/user/angular/test/mock/**/*.js
Try this "/home/user/angular/test/mock/*\.js"
/home/user/angular/test/mock/**/*\.js

Related

NuxtJS build breaks with UglifyJS and node-rsa. How do I resolve this?

I'm using the library node-rsa (https://www.npmjs.com/package/node-rsa) in a NuxtJS project. When building for production using the command nuxt build (which includes minification of JS and CSS by default), the build process breaks near the end with the following message:
ERROR in 0.nuxt.bundle.7c6932a7a42bdaaa7fa4.js from UglifyJs
Unexpected token: name (pem) [./~/node-rsa/src/formats/pkcs1.js:55,0][0.nuxt.bundle.7c6932a7a42bdaaa7fa4.js:42640,20]
Error: Webpack build exited with errors
at /home/ubuntu/front-end/node_modules/nuxt/dist/nuxt.js:904:44
at /home/ubuntu/front-end/node_modules/webpack/lib/Compiler.js:267:15
at Compiler.emitRecords (/home/ubuntu/front-end/node_modules/webpack/lib/Compiler.js:362:37)
at /home/ubuntu/front-end/node_modules/webpack/lib/Compiler.js:260:12
at /home/ubuntu/front-end/node_modules/webpack/lib/Compiler.js:355:11
at next (/home/ubuntu/front-end/node_modules/tapable/lib/Tapable.js:154:11)
at Compiler.compiler.plugin (/home/ubuntu/front-end/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4)
at Compiler.applyPluginsAsyncSeries1 (/home/ubuntu/front-end/node_modules/tapable/lib/Tapable.js:158:13)
at Compiler.afterEmit (/home/ubuntu/front-end/node_modules/webpack/lib/Compiler.js:352:8)
at Compiler.<anonymous> (/home/ubuntu/front-end/node_modules/webpack/lib/Compiler.js:347:14)
at /home/ubuntu/front-end/node_modules/async/dist/async.js:460:16
at iteratorCallback (/home/ubuntu/front-end/node_modules/async/dist/async.js:1034:13)
at /home/ubuntu/front-end/node_modules/async/dist/async.js:944:16
at /home/ubuntu/front-end/node_modules/graceful-fs/graceful-fs.js:43:10
at FSReqWrap.oncomplete (fs.js:117:15)
I was able to temporarily mitigate the issue by disabling uglifyJS (solution found at https://github.com/nuxt/nuxt.js/issues/250) but that does not seem like a long term solution. What is the correct way to resolve this?
Potentially related issue: Webpack breaks when i include node-rsa library
The problem is that I was trying to use a node library (not uglify-safe) on the browser without webpacking it. I switched to using pure JS for my crypto needs and everything went fine.

Cannot find module 'swagger_params_parser'

I have a Swagger NodeJS project which was created using Swagger
Swagger uses swagger-connect 0.1.0 out of the box but I've now upgraded to swagger-connect 0.7.0 using the manual instructions which included adding the following to config/default.yml:
_swagger_params_parser: # <= Add this definition
name: swagger_params_parser
jsonOptions: {}
urlencodedOptions:
extended: false
multerOptions:
inMemory: true
textOptions:
type: "*/*"
and under section 'swagger_controllers:' I've added :
- swagger_params_parser
This works gloriously on my local machine but when I push to the server it throws the error:
Error initializing middleware
May 22 13:25:27 myserver "myapp": Error: Cannot find module '/var/www/myapp/node_modules/swagger-connect/node_modules/swagger-node-runner/node_modules/bagpipes/lib/fittings/swagger_params_parser'
I'm starting the server via:
node app.js
So it looks like a potential dependency bleed on my local machine but I've destroyed (rm -Rf) 'node_modules' and re-run npm install and it still works fine on my local machine but breaks on the server.
Any ideas why swagger-params-parser is missing?
Also, another weird thing is that swagger-params-parser doesn't exist locally in directory '/var/www/myapp/node_modules/swagger-connect/node_modules/swagger-node-runner/node_modules/bagpipes/lib/fittings/swagger_params_parser' and yet locally it works!?
The issue turned out to be a stray node_modules directory on the server (we normally use node_modules_production).
Two things I've learned from this:
1.) node_modules is used instead of node_module_production if it exists. My RPM was not overwriting the directory and hence left an old copy of node_modules which was incorrectly packaged up at some point. The swagger app was loading modules from node_modules and not node_modules_production
2.) swagger_params_parser is indeed missing, even on the working version of the code so it looks like this error:
Error initializing middleware
May 22 13:25:27 myserver "myapp": Error: Cannot find module '/var/www/myapp/node_modules/swagger-connect/node_modules/swagger-node-runner/node_modules/bagpipes/lib/fittings/swagger_params_parser
is misleading, as that module is never present, at least in version 0.7.0 of swagger-connect

Cannot serve ionic3 app in localhost with ionic serve (blank page)

hi guys i was working on a app for 2 months, its never been before. today i typed ionic serve and it gave me a blank page. i tried again again again; nothing changed.
the errors of console is like that:
```
Failed to load resource: the server responded with a status of 404 (Not Found)
vendor.js Failed to load resource: the server responded with a status of 404 (Not Found)
main.js Failed to load resource: the server responded with a status of 404 (Not Found)
vendor.js Failed to load resource: the server responded with a status of 404 (Not Found)
main.js Failed to load resource: the server responded with a status of 404 (Not Found)
main.css Failed to load resource: the server responded with a status of 404 (Not Found)
```
then i searched for solution on the internet and tried that:
```
npm uninstall -g cordova ionic
npm install -g cordova ionic
```
but it didnt work!
so i remembered, once i backed up my app folder before. so i tried that and saw it works. i copied that back-up folder's www/build folder files to the my up to date app-folder. and run ionic serve again. it deletes all files automatically and doesnt work?
i cannot serve my app ? please assist me guys. i did nothing to receive that error i am shocked!
terminal:
```
Starting app-scripts server: --address 0.0.0.0 --port 8100 --livereload-port 35729 --dev-logger-port 53703 --nobrowser -
Ctrl+C to cancel
[04:35:39] watch started ...
[04:35:39] build dev started ...
[04:35:39] clean started ...
[04:35:39] clean finished in 7 ms
[04:35:39] copy started ...
[04:35:39] deeplinks started ...
[04:35:39] deeplinks finished in 236 ms
[04:35:39] transpile started ...
[04:35:43] dev server running: http://localhost:8100/
[OK] Development server running!
Local: http://localhost:8100
External: http://192.168.1.3:8100, http://192.168.136.1:8100, http://192.168.80.1:8100
DevApp: DenemeApp#8100 on ASUS
[04:35:44] copy finished in 4.77 s
[04:35:44] watch ready in 4.94 s
```
stops here.
my ionic info:
```
cli packages: (C:\Users\Uğur\AppData\Roaming\npm\node_modules)
#ionic/cli-utils : 1.19.0
ionic (Ionic CLI) : 3.19.0
global packages:
cordova (Cordova CLI) : 7.1.0
local packages:
#ionic/app-scripts : 3.0.1
Cordova Platforms : none
Ionic Framework : ionic-angular 3.8.0
System:
Node : v6.11.4
npm : 3.10.10
OS : Windows 8.1
Environment Variables:
ANDROID_HOME : not set
Misc:
backend : pro
```
Try serving your application in port 8102. I don't know how you managed it. But you changed the port where your build is available.
So run the following command :
$ ionic serve --p 8102
I couldnt find the solution, luckily i backed up the project lately. I dont know what i did to main folder but my backup folder working well. I did exact same changes (updated) and its working.

Running AtlasBoard on Azure Web App with iisnode

I´m trying to run AtlasBoard in an Azure Web App, but can´t get it to work. I have created a new board using the "Get started in 30 seconds" steps and the demo board runs fine when I start it locally. It works both by starting it with atlasboard start 3333or if I run node start.
I´ve added the node_modules directory to .gitignore.
I´m using git deployment on Azure and this seems to work fine. The deployment log also shows that the npm modules are installed.
This is the last ouput from the deployment:
Using start-up script start.js from package.json.
Generated web.config.
The iisnode.yml file explicitly sets nodeProcessCommandLine. Automatic node.js version selection is turned off.
Selected npm version 3.5.1
npm WARN Invalid name: "HRMTS AtlasBoard"
npm WARN wwwroot No description
npm WARN wwwroot No repository field.
npm WARN wwwroot No README data
npm WARN wwwroot No license field.
Finished successfully.
However, the app doesn´t seem to start and when I look at the log message in the Kudu console, I get this:
Error: error installing D:\home\site\wwwroot\packages\demo
at process.<anonymous> (D:\Program Files (x86)\iisnode\interceptor.js:73:106)
at emitOne (events.js:96:13)
at process.emit (events.js:188:7)
at process._fatalException (node.js:267:26)
Does anyone have a clue about what´s wrong here?
If you are using the repo of the demo application at https://bitbucket.org/atlassian/atlasboard/src to test on Azure, there several additional modifications we need do to make the test run on Azure Web Apps.
First of all, assume you have successfully deploy the application to Azure, and it failed when start running the application. Then you can leverage Kudu console site or Visual Studio Online extension (refer to the answer of How to install composer on app service? for how to enable extensions of Azure Web Apps) to check the error log at D:\home\site\wwwroot\packages\demo\npm-debug.log.
There are similar errors:
155 error node -v v0.6.20
156 error npm -v 1.1.37
157 error message SSL Error: CERT_UNTRUSTED
It seems that the atlasboard runs command with very low node version on Azure. We can manually modify the dependent scripts to bypass the errors.
If you get error during deployment, you should modify the npm version in package.json before deployment, for example:
"engines": {
"npm": ">2.0.0",
"node": ">=0.10"
},
After deployment:
check and modify the port in the start.js in the root directory:
atlasboard({port: process.env.port||3000 , install: true},
function (err) {
if (err) {
throw err;
}
});
modify the install function in D:\home\site\wwwroot\node_modules\atlasboard\lib\package-dependency-manager.js to use a higher npm version and remove --production param, e.g :
...
var npmCommand = isWindows ? "D:\\Program Files (x86)\\npm\\3.5.1\\npm.cmd" : "npm";
executeCommand(npmCommand, ["install", pathPackageJson], function(err, code){
...
})
Then restart your website.
Any further concern, please feel free to let me know.

Nodejitsu says my app is "not a Node app" - Is there a special way to write a node app for Nodejitsu deployment?

I've written a node app, which works fine for me locally, but when I try to install it to nodejitsu, I'm given the response:
C:\xampp\htdocs\officeball\node_scripts>jitsu install index_all.js
info: Welcome to Nodejitsu jt0dd1995
info: jitsu v0.13.9, node v0.10.23
info: It worked if it ends with Nodejitsu ok
info: Executing command install index_all.js
error: Sorry, index_all.js is not a node app
error: Error running command install index_all.js
help: For help with this error contact Nodejitsu Support:
help: webchat: <http://webchat.nodejitsu.com/>
help: irc: <irc://chat.freenode.net/#nodejitsu>
help: email: <support#nodejitsu.com>
help:
help: Copy and paste this output to a gist (http://gist.github.com/)
info: Nodejitsu not ok
C:\xampp\htdocs\officeball\node_scripts>
Is there a special way that I need to write a node app for it to work with nodejitsu?
Here's the app
Try to do
jitsu install
if u have a package.jsonfile that should work

Resources