question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

static injector error when serving universal-prod

See original GitHub issue

I’m submitting a … (check one with “x”)

[ ] Regression (a behavior that used to work and stopped working in a new release)
[x ] Bug report  <!-- Please check the repository for a similar issue or PR before submitting -->
[ ] Support request => <!-- Please check the repository for a similar issue or PR before submitting -->
[ ] Feature request
[ ] Documentation issue or request

Current behavior When I follow the documentation and run:

npm run build:universal-prod
npm run serve

and in the browser go to:

http://localhost:8000

I get the following error :

Express server listening on http://localhost:8000
TypeError: StaticInjectorError(AppServerModule)[InjectionToken Application Initializer -> InjectionToken DocumentToken]: 
  StaticInjectorError(Platform: core)[InjectionToken Application Initializer -> InjectionToken DocumentToken]: 
    Right-hand side of 'instanceof' is not an object
    at insertElement (/Users/bobsingor/Github/universal-original/.server/server.js:1:1931338)
    at insertHTMLElement (/Users/bobsingor/Github/universal-original/.server/server.js:1:1931060)
    at before_head_mode (/Users/bobsingor/Github/universal-original/.server/server.js:1:1969190)
    at HTMLParser.htmlparser.insertToken (/Users/bobsingor/Github/universal-original/.server/server.js:1:1930092)
    at /Users/bobsingor/Github/universal-original/.server/server.js:1:1935200
    at data_state (/Users/bobsingor/Github/universal-original/.server/server.js:1:1935238)
    at scanChars (/Users/bobsingor/Github/universal-original/.server/server.js:1:1926850)
    at Object.parse (/Users/bobsingor/Github/universal-original/.server/server.js:1:1925007)
    at Object.exports.createDocument (/Users/bobsingor/Github/universal-original/.server/server.js:1:3724599)
    at Object.exports.createWindow (/Users/bobsingor/Github/universal-original/.server/server.js:1:3724755)
TypeError: StaticInjectorError(AppServerModule)[InjectionToken Application Initializer -> InjectionToken DocumentToken]: 
  StaticInjectorError(Platform: core)[InjectionToken Application Initializer -> InjectionToken DocumentToken]: 
    Right-hand side of 'instanceof' is not an object
    at insertElement (/Users/bobsingor/Github/universal-original/.server/server.js:1:1931338)
    at insertHTMLElement (/Users/bobsingor/Github/universal-original/.server/server.js:1:1931060)
    at before_head_mode (/Users/bobsingor/Github/universal-original/.server/server.js:1:1969190)
    at HTMLParser.htmlparser.insertToken (/Users/bobsingor/Github/universal-original/.server/server.js:1:1930092)
    at /Users/bobsingor/Github/universal-original/.server/server.js:1:1935200
    at data_state (/Users/bobsingor/Github/universal-original/.server/server.js:1:1935238)
    at scanChars (/Users/bobsingor/Github/universal-original/.server/server.js:1:1926850)
    at Object.parse (/Users/bobsingor/Github/universal-original/.server/server.js:1:1925007)
    at Object.exports.createDocument (/Users/bobsingor/Github/universal-original/.server/server.js:1:3724599)
    at Object.exports.createWindow (/Users/bobsingor/Github/universal-original/.server/server.js:1:3724755)
  • For Tooling issues:
  • Node version: v8.9.1
  • Platform: Mac

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
vladoscommented, Feb 13, 2018

I can confirm fix in webpack.config.ts

const prodConfig = function (mangle = true) {
    return {
        /**
         * Add additional plugins to the compiler.
         *
         * See: http://webpack.github.io/docs/configuration.html#plugins
         */
        plugins: [
            /**
             * Plugin: UglifyJsPlugin
             * Description: Minimize all JavaScript output of chunks.
             * Loaders are switched into minimizing mode.
             *
             * See: https://webpack.github.io/docs/list-of-plugins.html#uglifyjsplugin
             */
            new uglifyJsPlugin({
                uglifyOptions: {
                    ecma: 6,
                    compress: false,
                    mangle: mangle,
                    comments: false

                }
            })
        ]
    };
};
0reactions
fulls1z3commented, Apr 17, 2018
Read more comments on GitHub >

github_iconTop Results From Across the Web

static injector error when serving universal-prod #284 - GitHub
Try commenting the ConfigMergeLoader and switch to ConfigStaticLoader (by copying the values from assets/config.local.json to its constructor) ...
Read more >
Type script - angular : static injector error - Stack Overflow
Hi i am trying to use socket.io in my angular project. there are three files which i am going to show which are...
Read more >
StaticInjectorError(ro): No Provider for | Angular : ng build --prod
fix #NullInjectorError # StaticInjectorError #provider In this video i will show you fix for angular staticinjectorerror nullinjectorerror no ...
Read more >
error: staticinjectorerror(dynamictestmodule)[httpclient]
In this lesson you will learn solution of these errors in Angular unit testing of http service.1- Error : ...
Read more >
Syndromic Surveillance
surveillance into well-organized business processes serving both ... After decades of investment into developing Universal Prod-.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found