Invalid mapping while running gulp - gulp

im trying to run gulp in node console and I get an error like below. I was looking over the net for a solution, but nothing has work so far. Hope you can help me.
C:\xampp\htdocs\wicie\wp-content\themes\domki-wicie\node_modules\source-map\lib\source-map-generator.js:298
throw new Error('Invalid mapping: ' + JSON.stringify({
^
Error: Invalid mapping: {"generated":{"line":157,"column":3},"source":"../bower_components/bootstrap/scss/mixins/_hover.scss","original":{"line":12,"column":-19},"name":null}
at SourceMapGenerator_validateMapping [as _validateMapping] (C:\xampp\htdocs\wicie\wp-content\themes\domki-wicie\node_modules\source-map\lib\source-map-generator.js:298:13)
at SourceMapGenerator_addMapping [as addMapping] (C:\xampp\htdocs\wicie\wp-content\themes\domki-wicie\node_modules\source-map\lib\source-map-generator.js:110:12)
at C:\xampp\htdocs\wicie\wp-content\themes\domki-wicie\node_modules\concat-with-sourcemaps\index.js:60:28
at Array.forEach ()
at BasicSourceMapConsumer.SourceMapConsumer_eachMapping [as eachMapping] (C:\xampp\htdocs\wicie\wp-content\themes\domki-wicie\node_modules\source-map\lib\source-map-consumer.js:157:14)
at Concat.add (C:\xampp\htdocs\wicie\wp-content\themes\domki-wicie\node_modules\concat-with-sourcemaps\index.js:58:18)
at DestroyableTransform.bufferContents [as _transform] (C:\xampp\htdocs\wicie\wp-content\themes\domki-wicie\node_modules\gulp-concat\index.js:68:12)
at DestroyableTransform.Transform._read (C:\xampp\htdocs\wicie\wp-content\themes\domki-wicie\node_modules\readable-stream\lib\_stream_transform.js:182:10)
at DestroyableTransform.Transform._write (C:\xampp\htdocs\wicie\wp-content\themes\domki-wicie\node_modules\readable-stream\lib\_stream_transform.js:170:83)
at doWrite (C:\xampp\htdocs\wicie\wp-content\themes\domki-wicie\node_modules\readable-stream\lib\_stream_writable.js:406:64)
Node version - 8.9.4
npm version - 5.6.0
source-map version - 0.6.1

Related

Re-frame dispatches and subscribes not working in the repl and test files

I have a re-frame project, and my events, subs and db cljs files are populated. I use these three in my project and it works well. But I created a test file, and called subscribe and dispatch in it like so:
(deftest category-filter-test
(dispatch [:add-filter "cat"])
(is (= #(subscribe [:filters]) ["cat"]))
)
And that doesn't work. I get
#object[Error Error: No protocol method IDeref.-deref defined for type undefined: ]
On the other hand, if I try to run subscribe in the shadow-cljs repl, I get the following error:
------ WARNING - :undeclared-ns ------------------------------------------------
Resource: :1:2
No such namespace: user, could not locate user.cljs, user.cljc, or JavaScript source providing "user"
--------------------------------------------------------------------------------
------ WARNING - :undeclared-var -----------------------------------------------
Resource: :1:2
Use of undeclared Var user/start
--------------------------------------------------------------------------------
ReferenceError: user is not defined
at eval (eval at shadow$cljs$devtools$client$browser$global_eval (http://localhost:3689/js/workspaces/cljs-runtime/shadow.cljs.devtools.client.browser.js), <anonymous>:1:1)
at eval (<anonymous>)
at Object.shadow$cljs$devtools$client$browser$global_eval [as global_eval] (http://localhost:3689/js/workspaces/cljs-runtime/shadow.cljs.devtools.client.browser.js:758:16)
at eval (http://localhost:3689/js/workspaces/cljs-runtime/shadow.cljs.devtools.client.browser.js:767:44)
at Object.shadow$cljs$devtools$client$env$repl_call [as repl_call] (http://localhost:3689/js/workspaces/cljs-runtime/shadow.cljs.devtools.client.env.js:167:108)
at Object.shadow$cljs$devtools$client$browser$repl_invoke [as repl_invoke] (http://localhost:3689/js/workspaces/cljs-runtime/shadow.cljs.devtools.client.browser.js:766:46)
at shadow$cljs$devtools$client$browser$handle_message (http://localhost:3689/js/workspaces/cljs-runtime/shadow.cljs.devtools.client.browser.js:844:37)
at eval (http://localhost:3689/js/workspaces/cljs-runtime/shadow.cljs.devtools.client.env.js:307:151)
at Object.shadow$cljs$devtools$client$env$process_next_BANG_ [as process_next_BANG_] (http://localhost:3689/js/workspaces/cljs-runtime/shadow.cljs.devtools.client.env.js:289:90)
at Object.shadow$cljs$devtools$client$env$process_ws_msg [as process_ws_msg] (http://localhost:3689/js/workspaces/cljs-runtime/shadow.cljs.devtools.client.env.js:310:40)
How to fix these two errors?

Webpack breaks when i include node-rsa library

When I try to include the node-rsa library with Webpack, as so:
import NodeRSA from 'node-rsa';
I get the following error:
ERROR in ./~/constants-browserify/constants.json
Module parse failed: /home/hencic00/Dropbox/Documents/Camelot/node_modules/constants-browserify/constants.json Unexpected token (2:12)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (2:12)
at Parser.pp$4.raise (/home/hencic00/Dropbox/Documents/Camelot/node_modules/acorn/dist/acorn.js:2221:15)
at Parser.pp.unexpected (/home/hencic00/Dropbox/Documents/Camelot/node_modules/acorn/dist/acorn.js:603:10)
at Parser.pp.semicolon (/home/hencic00/Dropbox/Documents/Camelot/node_modules/acorn/dist/acorn.js:581:61)
at Parser.pp$1.parseExpressionStatement (/home/hencic00/Dropbox/Documents/Camelot/node_modules/acorn/dist/acorn.js:966:10)
at Parser.pp$1.parseStatement (/home/hencic00/Dropbox/Documents/Camelot/node_modules/acorn/dist/acorn.js:730:24)
at Parser.pp$1.parseBlock (/home/hencic00/Dropbox/Documents/Camelot/node_modules/acorn/dist/acorn.js:981:25)
at Parser.pp$1.parseStatement (/home/hencic00/Dropbox/Documents/Camelot/node_modules/acorn/dist/acorn.js:709:33)
at Parser.pp$1.parseTopLevel (/home/hencic00/Dropbox/Documents/Camelot/node_modules/acorn/dist/acorn.js:638:25)
at Parser.parse (/home/hencic00/Dropbox/Documents/Camelot/node_modules/acorn/dist/acorn.js:516:17)
at Object.parse (/home/hencic00/Dropbox/Documents/Camelot/node_modules/acorn/dist/acorn.js:3098:39)
at Parser.parse (/home/hencic00/Dropbox/Documents/Camelot/node_modules/webpack/lib/Parser.js:902:15)
at DependenciesBlock.<anonymous> (/home/hencic00/Dropbox/Documents/Camelot/node_modules/webpack/lib/NormalModule.js:104:16)
at DependenciesBlock.onModuleBuild (/home/hencic00/Dropbox/Documents/Camelot/node_modules/webpack-core/lib/NormalModuleMixin.js:310:10)
at nextLoader (/home/hencic00/Dropbox/Documents/Camelot/node_modules/webpack-core/lib/NormalModuleMixin.js:275:25)
at /home/hencic00/Dropbox/Documents/Camelot/node_modules/webpack-core/lib/NormalModuleMixin.js:259:5
at Storage.finished (/home/hencic00/Dropbox/Documents/Camelot/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:38:16)
at /home/hencic00/Dropbox/Documents/Camelot/node_modules/graceful-fs/graceful-fs.js:78:16
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)
# ./~/node-rsa/src/NodeRSA.js 10:16-36
There doesn't seem to be any existing questions on this topic.
Any ideas?
Just add json loader to your webpack config.

Gulp-kss issues

I am trying to get gulp-kss working on my project, but I am encountering issues when I try to run my task. I get the following error message:
[12:07:28] Using gulpfile ~/Documents/Websites/company/project-uiapp/gulpfile.js
[12:07:28] Starting 'generate-sc'...
[12:07:28] Finished 'generate-sc' after 20 ms
fs.js:549
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: ENOENT: no such file or directory, open '/Users/Josua/Documents/Websites/company/project-uiapp/node_modules/gulp-kss/node_modules/kss/lib/template/index.html'
at Error (native)
at Object.fs.openSync (fs.js:549:18)
at Object.fs.readFileSync (fs.js:397:15)
at Stream.endStream (/Users/Josua/Documents/Websites/company/project-uiapp/node_modules/gulp-kss/index.js:42:27)
at _end (/Users/Josua/Documents/Websites/company/project-uiapp/node_modules/through/index.js:65:9)
at Stream.stream.end (/Users/Josua/Documents/Websites/company/project-uiapp/node_modules/through/index.js:74:5)
at DestroyableTransform.onend (/Users/Josua/Documents/Websites/company/project-uiapp/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:523:10)
at DestroyableTransform.g (events.js:260:16)
at emitNone (events.js:72:20)
at DestroyableTransform.emit (events.js:166:7)
at /Users/Josua/Documents/Websites/company/project-uiapp/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:965:16
at doNTCallback0 (node.js:419:9)
at process._tickDomainCallback (node.js:389:13)
How would I resolve this error? I have been searching Google and Stackoverflow but I have not found a solution yet. I am basing my solution off this gulp-kss. I have included my gulp task below:
...
// Generate styleguide with templates
gulp.task('generate-sc', function() {
gulp.src(['build-less'])
.pipe(gulpkss({
overview: __dirname + '/styles/styleguide.md'
}))
.pipe(gulp.dest('styleguide/'));
// Concat and compile all your styles for correct rendering of the styleguide.
gulp.src('./src/less/styles.less')
.pipe(less())
.pipe(gulpconcat('styles/style.css'))
.pipe(gulp.dest('styleguide/'));
...
I finally found the issue. I had to add kss to my package.json. I figured it would of been included with gulp-kss.

Gulp TypeError: Path must be a string. Received undefined

I want to run build command but got the error message:
TypeError: Path must be a string. Received undefined.
Do you guys have any ideas? Thanks.
gulp.task('build', function () {
browserify("./src/components/source.js")
.transform("babelify", {presets: ["es2015", "react"]})
.bundle()
.pipe(gulp.dest(path.resolve(__dirname, './src/app.js')));
});
Below is the tracestack details:
TypeError: Path must be a string. Received undefined
at assertPath (path.js:8:11)
at Object.posix.resolve (path.js:426:5)
at DestroyableTransform.saveFile [as _transform] (/Users/yzzhou/Documents/ReleasePlanner/node_modules/gulp/node_modules/vinyl-fs/lib/dest/index.js:36:26)
at DestroyableTransform.Transform._read (/Users/yzzhou/Documents/ReleasePlanner/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:184:10)
at DestroyableTransform.Transform._write (/Users/yzzhou/Documents/ReleasePlanner/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:172:12)
at doWrite (/Users/yzzhou/Documents/ReleasePlanner/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:237:10)
at writeOrBuffer (/Users/yzzhou/Documents/ReleasePlanner/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:227:5)
at DestroyableTransform.Writable.write (/Users/yzzhou/Documents/ReleasePlanner/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:194:11)

babel5 --> babel6: modules property

i'm trying to figure out how to tell babel6 to generate a particular module syntax (amd, commonjs, etc)
this is how i used to specify the module: https://github.com/aurelia/metadata/blob/master/build/tasks/build.js#L48
gulp.task('build-commonjs', function () {
return gulp.src(paths.output + jsName)
.pipe(to5(assign({}, compilerOptions, {modules:'common'})))
.pipe(gulp.dest(paths.output + 'commonjs'));
});
gulp.task('build-amd', function () {
return gulp.src(paths.output + jsName)
.pipe(to5(assign({}, compilerOptions, {modules:'amd'})))
.pipe(gulp.dest(paths.output + 'amd'));
});
babel6 gives me the error: Unknow option: base.modules
appreciate any guidance !! :)
error:
events.js:141
throw er; // Unhandled 'error' event
^
ReferenceError: [BABEL] C:\a\au\metadata\dist\aurelia-metadata.js: Unknown option: base.modules
at Logger.error (C:\a\au\metadata\node_modules\gulp-babel\node_modules\babel-core\lib\transformation\file\logger.js:41:11)
at OptionManager.mergeOptions (C:\a\au\metadata\node_modules\gulp-babel\node_modules\babel-core\lib\transformation\file\options\option-manager.js:262:18)
at OptionManager.init (C:\a\au\metadata\node_modules\gulp-babel\node_modules\babel-core\lib\transformation\file\options\option-manager.js:416:10)
at File.initOptions (C:\a\au\metadata\node_modules\gulp-babel\node_modules\babel-core\lib\transformation\file\index.js:191:75)
at new File (C:\a\au\metadata\node_modules\gulp-babel\node_modules\babel-core\lib\transformation\file\index.js:122:22)
at Pipeline.transform (C:\a\au\metadata\node_modules\gulp-babel\node_modules\babel-core\lib\transformation\pipeline.js:42:16)
at DestroyableTransform._transform (C:\a\au\metadata\node_modules\gulp-babel\index.js:32:20)
at DestroyableTransform.Transform._read (C:\a\au\metadata\node_modules\through2\node_modules\readable-stream\lib\_stream_transform.js:172:10)
at DestroyableTransform.Transform._write (C:\a\au\metadata\node_modules\through2\node_modules\readable-stream\lib\_stream_transform.js:160:12)
at doWrite (C:\a\au\metadata\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:335:12)
at writeOrBuffer (C:\a\au\metadata\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:321:5)
at DestroyableTransform.Writable.write (C:\a\au\metadata\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:248:11)
at write (C:\a\au\metadata\node_modules\gulp\node_modules\vinyl-fs\node_modules\through2\node_modules\readable-stream\lib\_stream_readable.js:623:24)
at flow (C:\a\au\metadata\node_modules\gulp\node_modules\vinyl-fs\node_modules\through2\node_modules\readable-stream\lib\_stream_readable.js:632:7)
at DestroyableTransform.pipeOnReadable (C:\a\au\metadata\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)
from #thedark1337 in babeljs slack:
For babel 6 you need to use plugins
https://babeljs.io/docs/plugins/transform-es2015-modules-amd
https://babeljs.io/docs/plugins/transform-es2015-modules-commonjs/
https://babeljs.io/docs/plugins/transform-es2015-modules-systemjs/
also if you haven't, you'll need babel-preset-es2015 as well to transpile from ES2015 to ES5