I'm having some difficulty with gulp-angular-templatecache. I have a gulpfile with a task:
gulp.task('templates', function() {
return gulp.src(paths.angularTemplates)
.pipe(templateCache())
/*.pipe(gulp.dest('javascript/angular'))*/;
});
I'm not sure why but the following error is thrown when piping to gulp-angular-templatecache and throws:
stream.js:74
throw er; // Unhandled stream error in pipe.
^
TypeError: Cannot read property 'toString' of null
at templateCacheFile (/home/vagrant/app/node_modules/gulp-angular-templatecache/index.js:89:40)
at wrappedMapper (/home/vagrant/app/node_modules/gulp-angular-templatecache/node_modules/event-stream/node_modules/map-stream/index.js:84:19)
at Stream.stream.write (/home/vagrant/app/node_modules/gulp-angular-templatecache/node_modules/event-stream/node_modules/map-stream/index.js:96:21)
at Stream.method [as write] (/home/vagrant/app/node_modules/gulp-angular-templatecache/node_modules/event-stream/node_modules/duplexer/index.js:47:39)
at write (/home/vagrant/app/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:623:24)
at flow (/home/vagrant/app/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:632:7)
at DestroyableTransform.pipeOnReadable (/home/vagrant/app/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:664:5)
at emitNone (events.js:67:13)
at DestroyableTransform.emit (events.js:166:7)
at emitReadable_ (/home/vagrant/app/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:448:10)
I'm not sure what problem this error is related to. Any help would be greatly appreciated.
Many thanks.
there was a newer gulp-angular-templatecache version which broke the it. Ended up specifying a specific version in the gulpfile
In my project this was caused by a folder name with a dot inside.
So, I had a folder called folder_name.html and had to rename it to folder_name.
(Using gulp-angular-templatecache version 1.9.1)
Related
I just set up a basic electron-react app by using electron-forge and adding React+webpack+typescript per instructions and it all works great (I haven't added anything beyond the basic setup). It compiles well with all green checkboxes.
However, when I hit the close button by mouse clicking the x in the top right, it shuts down but gives the following error:
An unhandled exception has occurred inside Forge:
Cannot read property 'close' of undefined
TypeError: Cannot read property 'close' of undefined
at WebpackPlugin.exitHandler (C:\Users\cwebb\Documents\Webdev\Atlas\node_modules\#electron-forge\plugin-webpack\src\WebpackPlugin.ts:83:16)
at ChildProcess.<anonymous> (C:\Users\cwebb\Documents\Webdev\Atlas\node_modules\#electron-forge\plugin-webpack\src\WebpackPlugin.ts:171:18)
at ChildProcess.emit (events.js:412:35)
at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
C:\Users\cwebb\Documents\Webdev\Atlas\node_modules\#electron-forge\plugin-webpack\dist\WebpackPlugin.js:87
server.close();
^
TypeError: Cannot read property 'close' of undefined
at WebpackPlugin.exitHandler (C:\Users\cwebb\Documents\Webdev\Atlas\node_modules\#electron-forge\plugin-webpack\src\WebpackPlugin.ts:83:16)
at process.<anonymous> (C:\Users\cwebb\Documents\Webdev\Atlas\node_modules\#electron-forge\plugin-webpack\src\WebpackPlugin.ts:126:40)
at process.emit (events.js:412:35)
at process.emit (C:\Users\cwebb\Documents\Webdev\Atlas\node_modules\source-map-support\source-map-support.js:516:21)
at processEmit [as emit] (C:\Users\cwebb\Documents\Webdev\Atlas\node_modules\signal-exit\index.js:155:35)
at process.exit (internal/process/per_thread.js:169:15)
at process.<anonymous> (C:\Users\cwebb\Documents\Webdev\Atlas\node_modules\#electron-forge\cli\src\util\terminate.ts:20:11)
at process.emit (events.js:400:28)
at process.emit (C:\Users\cwebb\Documents\Webdev\Atlas\node_modules\source-map-support\source-map-support.js:516:21)
at processEmit [as emit] (C:\Users\cwebb\Documents\Webdev\Atlas\node_modules\signal-exit\index.js:161:32)
at process._fatalException (internal/process/execution.js:167:25)
Any recommendations as to how to correct this? I found one answer on a gitmemory site but it just said "thanks it worked" but no comment about how to fix the problem.
Thank you in advance for your help.
I just ran into this today and managed to find a hint here
You have to bind to the Electron app's window-all-closed event if you don't want this to happen. Usually, you'd use this event to quit the app when all the windows are closed. Here's an example snippet from main.js:
const { app } = require('electron')
app.on('window-all-closed', () => {
app.quit()
})
If you want the app to keep running after you close all windows, you can remove the call to app.quit, but make sure to keep the binding to window-all-closed. Having the binding prevents the exception from being thrown.
I am getting this error when I run the command $ gatsby build on the terminal.
What gets my attention on this one is that it mentions jest-worker, and I don't see that module on my package.json. I see it only in the node_modules folder.
I already tried many things. Deleting node_modules, package_lock.json, npm cache clean --force and some other things.
I can't find these errors on the internet either.
If I keep scrolling down on the terminal, the error ends with this:
/Users/marcelo/Work/SM/gatsby-on-demand/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
throw ex;
^
Error: write EPIPE
at process.target._send (internal/child_process.js:806:20)
at process.target.send (internal/child_process.js:676:19)
at /Users/marcelo/Work/SM/gatsby-on-demand/node_modules/gatsby-cli/lib/reporter/loggers/ipc/index.js:58:13
at dispatch (/Users/marcelo/Work/SM/gatsby-on-demand/node_modules/gatsby-cli/lib/reporter/redux/index.js:54:5)
at Object.createLog (/Users/marcelo/Work/SM/gatsby-on-demand/node_modules/redux/lib/redux.js:483:12)
at Reporter.log (/Users/marcelo/Work/SM/gatsby-on-demand/node_modules/gatsby-cli/lib/reporter/reporter.js:173:40)
at Object.console.log (/Users/marcelo/Work/SM/gatsby-on-demand/node_modules/gatsby-cli/lib/reporter/patch-console.js:17:14)
at WithHeaderLayout (/Users/marcelo/Work/SM/gatsby-on-demand/public/render-page.js:104712:376)
at d (/Users/marcelo/Work/SM/gatsby-on-demand/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:36:498)
at $a (/Users/marcelo/Work/SM/gatsby-on-demand/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:39:16)
at a.b.render (/Users/marcelo/Work/SM/gatsby-on-demand/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:44:476)
at a.b.read (/Users/marcelo/Work/SM/gatsby-on-demand/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:44:18)
at renderToString (/Users/marcelo/Work/SM/gatsby-on-demand/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:54:364)
at Module.default (/Users/marcelo/Work/SM/gatsby-on-demand/public/render-page.js:710:28)
at /Users/marcelo/Work/SM/gatsby-on-demand/node_modules/gatsby/dist/utils/worker/render-html.js:28:36
at Promise._execute (/Users/marcelo/Work/SM/gatsby-on-demand/node_modules/bluebird/js/release/debuggability.js:384:9)
Emitted 'error' event on process instance at:
at processEmit [as emit] (/Users/marcelo/Work/SM/gatsby-on-demand/node_modules/signal-exit/index.js:161:32)
at internal/child_process.js:810:39
at processTicksAndRejections (internal/process/task_queues.js:75:11) {
errno: 'EPIPE',
code: 'EPIPE',
syscall: 'write'
}
I've been going through this the whole day.
Any ideas?
I am working on angularjs and node.js.
Problem:
I am getting following error in minified version of controller(Angular Controller js file). But it is working in the normal version.
Error:
Error: [$injector:unpr] http://errors.angularjs.org/1.2.25/$injector/unpr?p0=eProvider%20%3C-%20e
at Error (native)
at http://localhost:8080/assets/lib/js/angularjs/angular.min.js:6:450
at http://localhost:8080/assets/lib/js/angularjs/angular.min.js:36:202
at Object.c [as get] (http://localhost:8080/assets/lib/js/angularjs/angular.min.js:34:305)
at http://localhost:8080/assets/lib/js/angularjs/angular.min.js:36:270
at c (http://localhost:8080/assets/lib/js/angularjs/angular.min.js:34:305)
at d (http://localhost:8080/assets/lib/js/angularjs/angular.min.js:35:6)
at Object.instantiate (http://localhost:8080/assets/lib/js/angularjs/angular.min.js:35:165)
at http://localhost:8080/assets/lib/js/angularjs/angular.min.js:67:419
at link (http://localhost:8080/assets/lib/js/angularjs/angular-route.js:907:26) <div ng-view="" class="ng-scope">
I am using gulp-uglify to minify the controller
Code
gulp.task('buildControllerScript', function(){
return gulp.src(paths.controllers)
.pipe(concat('controllers.js'))
.pipe(gulp.dest('./public/dist/controllers/'))
.pipe(rename('controllers.min.js'))
.pipe(uglify())
.pipe(gulp.dest('./public/dist/controllers/'));
});
Note:
Seems to be something wrong while uglify.
I cannot expose the controller code due to privacy rules
Any suggestion will be grateful.
Since Angular's dependency injection depends on the names of your function parameters, you either need to use dependency annotation or replace the uglify gulp plugin with gulp-ng-annotate.
I get an error message -"ReferenceError: module is not defined" when trying to test angular js code.
test script [testSpec.js]
describe('Project controllers', function() {
beforeEach(module('project'));
describe('ListCtrl', function() {
expect(1).toBe(1);
});
});
I have the following entries in my html file
<script src="angular.min.js"></script>
<script src="angular-resource.min.js"></script>
<script src="angular-mocks.js"></script>
followed by my test script - testSpec.js
I specifically included angular.js and angular-mocks.js again. I get to see the following error message
Chrome 31.0.1650 (Windows 7) Project controllers ListCtrl should create 11 records FAILED
TypeError: Object #<Object> has no method 'apply'
Error: Unknown provider: ProjectsProvider <- Projects
at Error (<anonymous>)
at c:/Angular/angular-phonecat/app/angular.min.js:30:24
at Object.c [as get] (c:/Angular/angular-phonecat/app/angular.min.js:27:310)
at c:/Angular/angular-phonecat/app/angular.min.js:30:109
at c (c:/Angular/angular-phonecat/app/angular.min.js:27:310)
at d (c:/Angular/angular-phonecat/app/angular.min.js:27:444)
at Object.instantiate (c:/Angular/angular-phonecat/app/angular.min.js:29:80)
at c:/Angular/angular-phonecat/app/angular.min.js:53:80
at null.<anonymous> (c:/Angular/angular-phonecat/app/testSpec.js:10:12)
at Object.d [as invoke] (c:/Angular/angular-phonecat/app/angular.min.js:28:464)
Error: Declaration Location
at window.jasmine.window.inject.angular.mock.inject (c:/Angular/angular-phonecat/app/angular-mocks.js:1781:2
Here is the complete error
5) at null.<anonymous> (c:/Angular/angular-phonecat/app/testSpec.js:8:34)\n
at null.<anonymous> (c:/Angular/angular-phonecat/app/testSpec.js:6:2)\n
at c:/Angular/angular-phonecat/app/testSpec.js:2:1
Chrome 31.0.1650 (Windows 7) Project controllers ListCtrl should contain new fields FAILED
TypeError: Object #<Object> has no method 'apply'
Error: Unknown provider: ProjectsProvider <- Projects
I'm suspecting that you're missing some include files in you karma config file. Specifically, make sure you load angular.js.
Did you include angular-mocks.js ?
That should solve your problem.
You need that for it to work.
I am using RequireJS to organise my JS files. I am attempting optimize my files into one main JS file.
I am using the following command to do this:
/home/plugins/requireJS/build/build.sh name=main out=mesh-built.js baseUrl=/home/public_html/js/ includeRequire=true
The command produces the following error:
Tracing dependencies for: main
node.js:116
throw e; // process.nextTick error, or 'error' event on first tick
^
ReferenceError: $ is not defined
at eval at <anonymous> (/home/plugins/requireJS/bin/../build/jslib/requirePatch.js:147:21)
at Function.<anonymous> (eval at <anonymous> (/home/plugins/requireJS/bin/../build/jslib/requirePatch.js:147:21))
at Function.load (/home/plugins/requireJS/bin/../build/jslib/requirePatch.js:147:21)
at loadPaused (require.js:916:21)
at require.js:958:21
at Object.completeLoad (require.js:1207:17)
at Function.load (/home/plugins/requireJS/bin/../build/jslib/requirePatch.js:150:29)
at loadPaused (require.js:916:21)
at require.js:958:21
at Object.completeLoad (require.js:1207:17)
Does anyone know why it would be producing this error?
Many thanks.
I think its a problem with the order of the files to include. Make sure the JS file which defines the $() is included first.