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.

Inject fails for version 4.2.0

See original GitHub issue

Hello, inject seems to fail suddenly without any change in the task. This is the error I which I am facing,

(node:51098) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'startTag' of undefined
(node:51098) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

My gulp task: `gulp.task(‘update:index’, function () { var target = gulp.src(‘./app/index.html’);

var injectOptions = function(name){
    return {name: name, addRootSlash: false, transform: function(path){
        return '<script src="'+ path.replace('app/', '')+'"></script>'
    }}};
//Order must not change to avoid injector errors as angular looks the files in this order while bootstrapping the app
return target.pipe(inject(gulp.src(['./app/**/*.module.js']), injectOptions('module.js')))
    //all parent level js files
    .pipe(inject(gulp.src(['./app/*.js', '!./app/app.module.js', '!./app/*.spec.js'], {read:false}), injectOptions('main app')))
    .pipe(inject(gulp.src(['./app/api/api.services.js'], {read:false}), injectOptions('api service')))
    //all js files under api folder except module/services
    .pipe(inject(gulp.src(['./app/api/*.js', '!./app/api/*.module.js', '!./app/api/*.services.js', '!./app/api/*.spec.js'], {read:false}),
        injectOptions('api')))
    .pipe(inject(gulp.src(['./app/utils/stringUtils.js'], {read:false}), injectOptions('stringutils')))
    //all files under utils except module/stringUtils
    .pipe(inject(gulp.src(['./app/utils/*.js', '!./app/utils/*.module.js', '!./app/utils/stringUtils.js', '!./app/utils/*.spec.js'], {read:false}),
        injectOptions('utils')))
    //all files under authentication except module
    .pipe(inject(gulp.src(['./app/authentication/*.js', '!./app/authentication/*.module.js', '!./app/authentication/*.spec.js'], {read:false}),
        injectOptions('authentication')))
    //all files under shared except module
    .pipe(inject(gulp.src(['./app/shared/*.js', '!./app/shared/*.module.js', '!./app/shared/*.spec.js'], {read:false}), injectOptions('shared')))
    //all directives which are named as directive/directives which are under components
    .pipe(inject(gulp.src(['./app/components/**/*.directive.js', './app/components/**/*.directives.js'], {read:false}),
        injectOptions('component directives')))
    //all services under components
    .pipe(inject(gulp.src(['./app/components/**/*.service.js'], {read:false}),
        injectOptions('component services')))
    //all other js files under components which are neither directive/directives nor services
    .pipe(inject(gulp.src(['./app/components/**/*.js',
        '!./app/components/**/*.service.js', '!./app/components/**/*.directive.js',
        '!./app/components/**/*.directives.js', '!./app/components/**/*.module.js', '!./app/components/**/*.spec.js'], {read:false}),
        injectOptions('other component files')))
    .pipe(gulp.dest('./app'));

});`

There seems to be some dependency updates which I have observed,

new [INFO] ├─┬ gulp-inject@4.2.0 [INFO] │ ├── arrify@1.0.1 [INFO] │ ├── escape-string-regexp@1.0.5 [INFO] │ ├─┬ group-array@0.3.2 [INFO] │ │ ├── arr-flatten@1.0.1 [INFO] │ │ ├── get-value@2.0.6 [INFO] │ │ ├─┬ kind-of@3.1.0 [INFO] │ │ │ └── is-buffer@1.1.4 [INFO] │ │ └─┬ union-value@0.2.3 [INFO] │ │ ├── arr-union@3.1.0 [INFO] │ │ └─┬ set-value@0.3.3 [INFO] │ │ ├── extend-shallow@2.0.1 [INFO] │ │ └─┬ to-object-path@0.2.0 [INFO] │ │ └── is-arguments@1.0.2 [INFO] │ └─┬ stream-to-array@2.3.0 [INFO] │ └── any-promise@1.3.0

OLD which was working

[INFO] ├─┬ gulp-inject@4.2.0 [INFO] │ ├── arrify@1.0.1 [INFO] │ ├── escape-string-regexp@1.0.5 [INFO] │ ├─┬ group-array@0.3.1 [INFO] │ │ ├── get-value@2.0.6 [INFO] │ │ └─┬ kind-of@3.1.0 [INFO] │ │ └── is-buffer@1.1.4 [INFO] │ └─┬ stream-to-array@2.3.0 [INFO] │ └── any-promise@1.3.0

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:4
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
chaitanyavangooricommented, Mar 1, 2017

It worked after changing package.json from group-array : “^0.3.0” to group-array: “0.3.1”.

Please try to fix the dependencies.

1reaction
hedaukartikcommented, Mar 11, 2018

gulp inject [00:12:32] Using gulpfile ~\Documents\NodejsWorkshop\gulpfile.js [00:12:32] Starting ‘inject’… (node:26112) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): [object Object] (node:26112) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

var gulp = require(‘gulp’); var jshint = require(‘gulp-jshint’); var jscs = require(‘gulp-jscs’); var nodemon = require(‘gulp-nodemon’); var jsFiles = [‘.js’,'src/**/.js’]; gulp.task(‘style’,function(){ return gulp.src(jsFiles) .pipe(jshint()) .pipe(jshint.reporter(‘jshint-stylish’, {verbose : true})) .pipe(jscs());

});

gulp.task(‘inject’,function(){ var wiredep = require(‘wiredep’).stream; var inject = require(‘gulp-inject’);

var injectSrc = gulp.src([‘,/public/css/.css’, './public/js/.js’],{read : false}); var injectOptions = { ignorePath: ‘/public’ }; var options = { bowerJson : require(‘./bower.json’), directory : ‘./public/lib’ }; return gulp.src(‘./src/views/*.html’) .pipe(wiredep(options)) .pipe(inject(injectSrc, injectOptions)) .pipe(gulp.dest(‘./src/views’));

});

please help!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - Inject fails for version 4.2.0 - - Bountysource
Coming soon: A brand new website interface for an even better experience!
Read more >
Unable to fix error "Could not load System.Net.Http, Version ...
When this happens to me, I run the command Update-Package -reinstall from a NuGet package console window in visual studio. Seems to happen...
Read more >
Pip install of wxPython 4.2.0 fails with python 3.11 · Issue #2296
Description of the problem: It is possible to download wxPython 4.2.0 with python 3.11, but the installation fails with the following error.
Read more >
Known issues with Android Studio and Android Gradle Plugin
To fix this issue, upgrade your Android 11 emulator to version 9 or higher by navigating to Tools > SDK Manager. In the...
Read more >
[Rd] R 4.2.0 is released
The build system rolled up R-4.2.0.tar.gz (codename "Vigorous ... This warning can be turned into an error by setting environment variable ...
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