Angular2 Server Side Rendering - Angular 2 Universal Issue - node.js

I tried changing my angular2 app to angular2 universal. On that I segregated server and client side module. On doing npm start I am getting the following error.
EXCEPTION: The selector "app-root" did not match any elements
ORIGINAL STACKTRACE:
Error: The selector "app-root" did not match any elements
at DomRenderer.selectRootElement (C:\Users\SYS168\scotchiversal - Copy\dist\server\index.js:26663:23)
at selectOrCreateRenderHostElement (C:\Users\SYS168\scotchiversal - Copy\dist\server\index.js:15131:32)
at AppView._View_AppComponent_Host0.createInternal (/AppModule/AppComponent/host.ngfactory.js:12:16)
at AppView.create (C:\Users\SYS168\scotchiversal - Copy\dist\server\index.js:51125:21)
at ComponentFactory.create (C:\Users\SYS168\scotchiversal - Copy\dist\server\index.js:36104:36)
at ApplicationRef_.bootstrap (C:\Users\SYS168\scotchiversal - Copy\dist\server\index.js:22794:40)
at C:\Users\SYS168\scotchiversal - Copy\dist\server\index.js:22703:89
at Array.forEach (native)
at PlatformRef_._moduleDoBootstrap (C:\Users\SYS168\scotchiversal - Copy\dist\server\index.js:22703:42)
at C:\Users\SYS168\scotchiversal - Copy\dist\server\index.js:22671:27
Can you please somebody help me out.
This is my folder structure https://s11.postimg.org/g5xht8k6b/git.png
My folder structure

Related

ELectron React Boilerplate random error at start

I have a project, very simple, based on ERB, but 50% of the time I started I get the following error in the (webkit) console:
Uncaught TypeError: Cannot read properties of undefined (reading 'forEach')
at Object.injectIntoGlobalHook (react-refresh-runtime.development.js:449:1)
at Object../node_modules/#pmmmwh/react-refresh-webpack-plugin/client/ReactRefreshEntry.js (ReactRefreshEntry.js:17:1)
at Object.options.factory (react refresh:6:1)
at __webpack_require__ (bootstrap:24:1)
at startup:4:1
at startup:10:1
at webpackUniversalModuleDefinition (universalModuleDefinition:7:1)
at universalModuleDefinition:10:2
The application starts, load a blank screen with the above error in the console.
In the terminal I see the following messages:
08:21:21.774 > Skip checkForUpdatesAndNotify because application is not packed
<i> [webpack-dev-middleware] wait until bundle finished: /index.html
[19072:0519/082130.210:ERROR:CONSOLE(160)] "Electron sandbox_bundle.js script failed to run", source: node:electron/js2c/sandbox_bundle (160)
[19072:0519/082130.210:ERROR:CONSOLE(160)] "TypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator))", source: node:electron/js2c/sandbox_bundle (160)
The crazy thing is that yesterday before closing the PC it was working fine, this morning, I've run it again without making any change, the same code as yesterday, and I get the error.
Please give me some hint because I really don't know what to search for!

How do I make Gatsby + netlify website work on my machine?

I deployed an app with netlify + gatsby default options and then I cloned that repo, so I can edit the style. The problem is that it doesn't work on my machine, the following error persists:
2 problems (0 errors, 2 warnings)
ERROR #98123 WEBPACK
Generating development JavaScript bundle failed
$black: #2b2523;
^
Invalid CSS after "...black: #2b2523;": expected 1 selector or at-rule,
was ".navbar .navbar-men"
in /Users/micazev/Documents/ecominimalismo.com/src/components/all.sass
(line 11, column 17)
File: src/components/all.sass
failed Building development bundle - 22.833s
ERROR Failed to compile with 1 errors 14:39:49
⠀
error in ./src/components/all.sass
⠀
Module build failed (from
./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from
./node_modules/sass-loader/dist/cjs.js):
$black: #2b2523;
^
Invalid CSS after "...black: #2b2523;": expected 1 selector or at-rule,
was ".navbar .navbar-men"
in /Users/micazev/Documents/ecominimalismo.com/src/components/all.sass
(line 11, column 17)
at /Users/micazev/Documents/ecominimalismo.com/node_modules/webpack/lib/Norm
alModule.js:316:20
at /Users/micazev/Documents/ecominimalismo.com/node_modules/loader-runner/li
b/LoaderRunner.js:367:11
at /Users/micazev/Documents/ecominimalismo.com/node_modules/loader-runner/li
b/LoaderRunner.js:233:18
at context.callback (/Users/micazev/Documents/ecominimalismo.com/node_module
s/loader-runner/lib/LoaderRunner.js:111:13)
at Object.callback (/Users/micazev/Documents/ecominimalismo.com/node_modules
/sass-loader/dist/index.js:89:7)
at Object.done [as callback] (/Users/micazev/Documents/ecominimalismo.com/no
de_modules/neo-async/async.js:8069:18)
at options.error (/Users/micazev/Documents/ecominimalismo.com/node_modules/n
ode-sass/lib/index.js:294:32)
# ./src/components/Layout.js 17:0-20
# ./src/templates/blog-post.js
# ./src/cms/preview-templates/BlogPostPreview.js
# ./src/cms/cms.js
# multi ./node_modules/gatsby-plugin-netlify-cms/cms.js
./node_modules/gatsby-plugin-netlify-cms/cms-identity.js ./src/cms/cms.js
My repo is: https://github.com/micazev/ecominimalismo.com
I don't know what other info I could give. Please, help.
According to some threads about that starter, there's a bug about the Sass loaders that causes this issue. You have many solutions provided in this GitHub thread:
Add options to the gatsby-plugin-sass:
{
resolve: 'gatsby-plugin-sass',
options: {
indentedSyntax: true
}
}
This will allow the loader to understand the indented syntax of Sass.
Changing the extension from .sass to .scss, changing also all the references in the project: you'll need to add semicolons (;) and braces ({}) when needed.
Obviously, the second one is easier and safer.

jsreport failing on looking up extensions

So I recently started working on a linux machine (ubuntu 16.04) and followed the installation instructions here http://jsreport.net/downloads/. When I run npm start --production I get
2016-09-13T16:51:57.134Z - info: Initializing jsreport in production mode using configuration file prod.config.json
2016-09-13T16:51:57.138Z - info: Setting process based strategy for rendering. Please visit http://jsreport.net/learn/configuration for information how to get more performance.
2016-09-13T16:51:57.146Z - info: Searching for available extensions in /home/ross/rifiniti/optimo_ui/
2016-09-13T16:51:57.152Z - info: Extensions location cache not found, crawling directories
2016-09-13T16:51:57.317Z - error: Error occured during reporter init Error: ENOENT, no such file or directory '/home/ross/rifiniti/optimo_ui/ember/tmp/tree_merger-tmp_dest_dir-2yGnPLMA.tmp/optimo-ui/config'
at Error (native)
at Object.fs.statSync (fs.js:801:18)
at /home/ross/rifiniti/optimo_ui/node_modules/jsreport/node_modules/jsreport-core/lib/util/util.js:51:21
at Array.forEach (native)
at Object.exports.walkSync (/home/ross/rifiniti/optimo_ui/node_modules/jsreport/node_modules/jsreport-core/lib/util/util.js:44:10)
at /home/ross/rifiniti/optimo_ui/node_modules/jsreport/node_modules/jsreport-core/lib/extensions/locationCache.js:50:20
From previous event:
at /home/ross/rifiniti/optimo_ui/node_modules/jsreport/node_modules/jsreport-core/lib/reporter.js:90:8
From previous event:
at Reporter.init (/home/ross/rifiniti/optimo_ui/node_modules/jsreport/node_modules/jsreport-core/lib/reporter.js:69:30)
at Reporter.reporter.init (/home/ross/rifiniti/optimo_ui/node_modules/jsreport/lib/extendInit.js:8:21)
at Object.<anonymous> (/home/ross/rifiniti/optimo_ui/server.js:1:85)
And I have no idea why. It was working fine on mac but now it is looking for this non-existent tmp file in ember. I'm at a loss, any help would be greatly appreciated!
SOLVED!
All I had to do was remove the tmp directory in ember and it worked.

canvasengine Tiled_server Error: ENOENT, open './map.json'

This is my problem:
I try start Canvasengine example server and I get this error.
root#vps185158:/# node /var/www/canvas/canvasengine/examples/tiled_server/server/server.js
info - socket.io started
debug - client authorized
info - handshake authorized ogjRNMePBqcD_ZIkFVFK
debug - setting request GET /socket.io/1/websocket/ogjRNMePBqcD_ZIkFVFK
debug - set heartbeat interval for client ogjRNMePBqcD_ZIkFVFK
debug - client authorized for
debug - websocket writing 1::
/node_modules/canvasengine/core/engine-common.js:373
if (err) throw err;
^
Error: ENOENT, open './map.json'
at Error (native)
map.json is there, but nodejs can't find that file.
Server have Debian 7, nodejs, Socket.io and CanvasEngine 1.3.0
Looking at the code, you should either copy map.json to your working directory (which seems to be /, so I wouldn't necessarily recommend that) or start the server from its respective directory:
$ cd /var/www/canvas/canvasengine/examples/tiled_server/server/
$ node server
(although this may require setting $NODE_PATH)

Html Webpack Plugin: Child Compilation Failed error in React page

I'm new to React, and I'm following a tutorial, and after a 'yarn start' command, I go to 'localhost:3000' and see this error appear:
Error: Child compilation failed:
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: [BABEL] C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\webpack\buildin\glob al.js: Cannot find module './src/data'
It's the first step of the tutorial that has anything to do with React at all, so I don't see where could I have gone wrong, any ideas on what the problem might be would be very useful.
The full error is this:
Error: Child compilation failed:
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: [BABEL] C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\webpack\buildin\glob al.js: Cannot find module './src/data'
Require stack:
- C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\core-js-compat\helpers.js
- C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\core-js-compat\get-modules-list-f or-target-version.js
- C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\babel-preset-react-app\node_modul es\#babel\preset-env\lib\polyfills\corejs3\entry-plugin.js
- C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\babel-preset-react-app\node_modul es\#babel\preset-env\lib\index.js
- C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\babel-preset-react-app\dependenci es.js
- C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\#babel\core\lib\config\files\plug ins.js
- C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\#babel\core\lib\config\files\inde x.js
- C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\#babel\core\lib\index.js
- C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\babel-loader\lib\index.js
- C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\loader-runner\lib\loadLoader.js
- C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\loader-runner\lib\LoaderRunner.js - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\webpack\lib\NormalModule.js
- C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\webpack\lib\NormalModuleFactory.j s
- C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\webpack\lib\Compiler.js
- C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\webpack\lib\webpack.js
- C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\react-scripts\scripts\start.js (W hile processing: "C:\\Users\\Iván\\PycharmProjects\\django_react\\django-todo-react\\frontend\\node_modules\\babel-pre set-react-app\\dependencies.js$0$9")
- loader.js:797 Function.Module._resolveFilename
internal/modules/cjs/loader.js:797:15
- loader.js:690 Function.Module._load
internal/modules/cjs/loader.js:690:27
- loader.js:852 Module.require
internal/modules/cjs/loader.js:852:19
- helpers.js:74 require
internal/modules/cjs/helpers.js:74:18
- helpers.js:3 Object.
[frontend]/[core-js-compat]/helpers.js:3:14
- loader.js:959 Module._compile
internal/modules/cjs/loader.js:959:30
- loader.js:995 Object.Module._extensions..js
internal/modules/cjs/loader.js:995:10
- loader.js:815 Module.load
internal/modules/cjs/loader.js:815:32
- loader.js:727 Function.Module._load
internal/modules/cjs/loader.js:727:14
- loader.js:852 Module.require
internal/modules/cjs/loader.js:852:19
- helpers.js:74 require
internal/modules/cjs/helpers.js:74:18
- get-modules-list-for-target-version.js:2 Object.
[frontend]/[core-js-compat]/get-modules-list-for-target-version.js:2:51
- loader.js:959 Module._compile
internal/modules/cjs/loader.js:959:30
- loader.js:995 Object.Module._extensions..js
internal/modules/cjs/loader.js:995:10
- loader.js:815 Module.load
internal/modules/cjs/loader.js:815:32
- Error: [BABEL] C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\webpack\buildin\gl obal.js: Cannot find module './src/data'
- Require stack:
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\core-js-compat\helpers.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\core-js-compat\get-modules-list -for-target-version.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\babel-preset-react-app\node_mod ules\#babel\preset-env\lib\polyfills\corejs3\entry-plugin.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\babel-preset-react-app\node_mod ules\#babel\preset-env\lib\index.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\babel-preset-react-app\dependen cies.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\#babel\core\lib\config\files\pl ugins.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\#babel\core\lib\config\files\in dex.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\#babel\core\lib\index.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\babel-loader\lib\index.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\loader-runner\lib\loadLoader.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\loader-runner\lib\LoaderRunner. js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\webpack\lib\NormalModule.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\webpack\lib\NormalModuleFactory .js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\webpack\lib\Compiler.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\webpack\lib\webpack.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\react-scripts\scripts\start.js (While processing: "C:\\Users\\Iván\\PycharmProjects\\django_react\\django-todo-react\\frontend\\node_modules\\babel -preset-react-app\\dependencies.js$0$9")
- Module build failed (from ./node_modules/babel-loader/lib/index.js):
- Error: [BABEL] C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\webpack\buildin\mo dule.js: Cannot find module './src/data'
- Require stack:
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\core-js-compat\helpers.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\core-js-compat\get-modules-list -for-target-version.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\babel-preset-react-app\node_mod ules\#babel\preset-env\lib\polyfills\corejs3\entry-plugin.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\babel-preset-react-app\node_mod ules\#babel\preset-env\lib\index.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\babel-preset-react-app\dependen cies.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\#babel\core\lib\config\files\pl ugins.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\#babel\core\lib\config\files\in dex.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\#babel\core\lib\index.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\babel-loader\lib\index.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\loader-runner\lib\loadLoader.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\loader-runner\lib\LoaderRunner. js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\webpack\lib\NormalModule.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\webpack\lib\NormalModuleFactory .js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\webpack\lib\Compiler.js
I see three errors in total, all saying "Cannot find module './src/data'", so I guess there's that missing? In my project directory, I don't see anything called 'data' in the 'src' folder. Why could that be, or what should I add to fix it?
I think there is a bug in the core-js-combat version 3.4.6. This nasty bug is already fixed in version 3.4.7. So you can run npm install core-js-compat#3.4.7 --save .
temporary fix until the core-js-compat makes its way through all the repos:
npm i -s core-js-compat#3.4.7
Apparently this is related to a bad build of core-js-compat, which is a deep dependency of babel. These two posts have more information:
Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Cannot find module './src/data'
I am getting an error of Html Webpack Plugin in reactjs
This is working for me you can also try this
npm install core-js-compat#3.4.7 --save

Resources