Closed aruzikulov closed 6 years ago
Install latest node or at least latest npm : ‘npm up -g’, then reinstall modules
upgraded node v.10.7.0 and npm v.6.1.0
TypeError: mime.lookup is not a function
at /home/ahmad/code/jsuz/javascript-tutorial-server/handlers/tutorial/lib/tutorialImporter.js:579:21
at Array.filter (
this fixed the problem, now working perfect as charm use mime-type instead of mime. So, Install mime-types first: npm install mime-types then make change in your code: const mime=require('mime-types');
source:https://stackoverflow.com/questions/46420905/webrtc-error-with-mime-lookup
Should work with current mime.
If we'll see that error again, I'll fix it =)
Ubuntu 18.04, latest update, Node v8.11.3, npm v5.6.0 I followed all the steps carefully, and run 'npm install' and ./edit uz got this: $ npm install npm WARN deprecated gulp-util@3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5 npm WARN deprecated node-uuid@1.4.8: Use uuid module instead npm WARN deprecated graceful-fs@3.0.11: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools. npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated graceful-fs@1.2.3: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
make: Entering directory '/home/ahmad/code/jsuz/javascript-tutorial-server/node_modules/dtrace-provider/build' TOUCH Release/obj.target/DTraceProviderStub.stamp make: Leaving directory '/home/ahmad/code/jsuz/javascript-tutorial-server/node_modules/dtrace-provider/build'
npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
added 1276 packages in 39.221s
$ ./edit uz
ahmad@matebook:~/code/jsuz/javascript-tutorial-server$ ./edit uz [10:22:25] Using gulpfile ~/code/jsuz/javascript-tutorial-server/gulpfile.js [10:22:25] Starting 'client:webpack'... [10:22:25] Starting 'tutorial:importWatch'... {"name":"tutorialImporter","hostname":"matebook","pid":24562,"level":30,"msg":"sync /home/ahmad/code/jsuz/javascript-tutorial-uz/1-js","time":"2018-07-21T02:22:26.156Z","v":0} {"name":"tutorialImporter","hostname":"matebook","pid":24562,"level":30,"msg":"syncFolder /home/ahmad/code/jsuz/javascript-tutorial-uz/1-js","time":"2018-07-21T02:22:26.157Z","v":0} [10:22:26] Starting 'client:sync-resources'... [10:22:26] Finished 'client:sync-resources' after 27 ms [10:22:26] Starting 'client:livereload'... [10:22:26] Starting 'server'... (node:24562) DeprecationWarning: Tapable.plugin is deprecated. Use new API on)
at readFs (/home/ahmad/code/jsuz/javascript-tutorial-server/handlers/tutorial/lib/tutorialImporter.js:570:17)
at TutorialImporter.syncView (/home/ahmad/code/jsuz/javascript-tutorial-server/handlers/tutorial/lib/tutorialImporter.js:385:25)
at TutorialImporter.syncTask (/home/ahmad/code/jsuz/javascript-tutorial-server/handlers/tutorial/lib/tutorialImporter.js:347:20)
at
Gulp error details [ 'mime.lookup is not a function',
'TypeError: mime.lookup is not a function\n at /home/ahmad/code/jsuz/javascript-tutorial-server/handlers/tutorial/lib/tutorialImporter.js:579:21\n at Array.filter ()\n at readFs (/home/ahmad/code/jsuz/javascript-tutorial-server/handlers/tutorial/lib/tutorialImporter.js:570:17)\n at TutorialImporter.syncView (/home/ahmad/code/jsuz/javascript-tutorial-server/handlers/tutorial/lib/tutorialImporter.js:385:25)\n at TutorialImporter.syncTask (/home/ahmad/code/jsuz/javascript-tutorial-server/handlers/tutorial/lib/tutorialImporter.js:347:20)\n at ' ]
[10:22:29] livereload: listen on change public/pack/*/.,!public/pack/head.js
[10:22:31] [webpack] Time: 5771ms
Built at: 2018-07-21 10:22:31
Asset Size Chunks Chunk Names
styles/blocks/font/icons.woff 14.6 KiB [emitted]
.hooks
instead {"name":"tutorialImporter","hostname":"matebook","pid":24562,"level":30,"msg":"syncFolder /home/ahmad/code/jsuz/javascript-tutorial-uz/1-js/01-getting-started","time":"2018-07-21T02:22:26.302Z","v":0} {"name":"tutorialImporter","hostname":"matebook","pid":24562,"level":30,"msg":"syncArticle /home/ahmad/code/jsuz/javascript-tutorial-uz/1-js/01-getting-started/1-intro","time":"2018-07-21T02:22:26.304Z","v":0} {"name":"application","hostname":"matebook","pid":24562,"level":30,"msg":"Server is listening 0.0.0.0:3000","time":"2018-07-21T02:22:26.316Z","v":0} [10:22:26] Finished 'server' after 110 ms {"name":"tutorialImporter","hostname":"matebook","pid":24562,"level":30,"msg":"syncArticle /home/ahmad/code/jsuz/javascript-tutorial-uz/1-js/01-getting-started/2-code-editors","time":"2018-07-21T02:22:26.350Z","v":0} {"name":"tutorialImporter","hostname":"matebook","pid":24562,"level":30,"msg":"syncArticle /home/ahmad/code/jsuz/javascript-tutorial-uz/1-js/01-getting-started/3-devtools","time":"2018-07-21T02:22:26.355Z","v":0} {"name":"tutorialImporter","hostname":"matebook","pid":24562,"level":30,"msg":"syncFolder /home/ahmad/code/jsuz/javascript-tutorial-uz/1-js/02-first-steps","time":"2018-07-21T02:22:26.430Z","v":0} {"name":"tutorialImporter","hostname":"matebook","pid":24562,"level":30,"msg":"syncArticle /home/ahmad/code/jsuz/javascript-tutorial-uz/1-js/02-first-steps/01-hello-world","time":"2018-07-21T02:22:26.432Z","v":0} {"name":"tutorialImporter","hostname":"matebook","pid":24562,"level":30,"msg":"syncView: dir /home/ahmad/code/jsuz/javascript-tutorial-uz/1-js/02-first-steps/01-hello-world/1-hello-alert/solution.view","time":"2018-07-21T02:22:26.439Z","v":0} [10:22:26] 'tutorial:importWatch' errored after 882 ms [10:22:26] TypeError: mime.lookup is not a function at /home/ahmad/code/jsuz/javascript-tutorial-server/handlers/tutorial/lib/tutorialImporter.js:579:21 at Array.filter (styles/blocks/font/icons.otf 22.6 KiB [emitted]
styles/blocks/page-footer/slack.svg 1.49 KiB [emitted]
styles.css 85.7 KiB 0 [emitted] styles styles.js 1.13 KiB 0 [emitted] styles head.js 18.3 KiB 1 [emitted] head tutorial.js 34 KiB 2 [emitted] tutorial footer.js 4.59 KiB 3 [emitted] footer Entrypoint styles = styles.css styles.js Entrypoint head = head.js Entrypoint tutorial = tutorial.js Entrypoint footer = footer.js Child mini-css-extract-plugin node_modules/css-loader/index.js??ref--9-1!node_modules/postcss-loader/lib/index.js??ref--9-2!modules/hover-loader.js!node_modules/stylus-loader/index.js??ref--9-4!tmp/styles.styl: Asset Size Chunks Chunk Names styles/blocks/font/icons.woff 14.6 KiB [emitted]
styles/blocks/font/icons.otf 22.6 KiB [emitted]
styles/blocks/page-footer/slack.svg 1.49 KiB [emitted]
Entrypoint mini-css-extract-plugin = [10:22:31] Finished 'client:webpack' after 5.97 s
And I did: $ npm install mime npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
mime@2.3.1 removed 1 package and updated 1 package in 8.064s
and again: $ ./edit uz ahmad@matebook:~/code/jsuz/javascript-tutorial-server$ ./edit uz [10:30:02] Using gulpfile ~/code/jsuz/javascript-tutorial-server/gulpfile.js [10:30:02] Starting 'client:webpack'... [10:30:02] Starting 'tutorial:importWatch'... [10:30:03] 'tutorial:importWatch' errored after 325 ms [10:30:03] Error: Pug file bemto.pug/lib/index from /home/ahmad/code/jsuz/javascript-tutorial-server/modules/markit/templates/codeTabs.pug not resolved at /home/ahmad/code/jsuz/javascript-tutorial-server/modules/markit/templates/codeTabs.pug line 1 at Object.pugResolve [as resolve] (/home/ahmad/code/jsuz/javascript-tutorial-server/modules/pugResolve.js:34:13) at Object.resolve (/home/ahmad/code/jsuz/javascript-tutorial-server/node_modules/pug/lib/index.js:132:16) at /home/ahmad/code/jsuz/javascript-tutorial-server/node_modules/pug-load/index.js:22:26 at walkAST (/home/ahmad/code/jsuz/javascript-tutorial-server/node_modules/pug-walk/index.js:23:18) at /home/ahmad/code/jsuz/javascript-tutorial-server/node_modules/pug-walk/index.js:104:20 at Array.reduce ()
at walkAndMergeNodes (/home/ahmad/code/jsuz/javascript-tutorial-server/node_modules/pug-walk/index.js:103:18)
at walkAST (/home/ahmad/code/jsuz/javascript-tutorial-server/node_modules/pug-walk/index.js:37:19)
at load (/home/ahmad/code/jsuz/javascript-tutorial-server/node_modules/pug-load/index.js:13:10)
at Function.loadString [as string] (/home/ahmad/code/jsuz/javascript-tutorial-server/node_modules/pug-load/index.js:46:10)
at compileBody (/home/ahmad/code/jsuz/javascript-tutorial-server/node_modules/pug/lib/index.js:86:18)
at Object.exports.compile (/home/ahmad/code/jsuz/javascript-tutorial-server/node_modules/pug/lib/index.js:242:16)
at Object.require.extensions..pug (/home/ahmad/code/jsuz/javascript-tutorial-server/modules/lib/serverPug/index.js:13:22)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
Gulp error details [ 'Pug file bemto.pug/lib/index from /home/ahmad/code/jsuz/javascript-tutorial-server/modules/markit/templates/codeTabs.pug not resolved\n at /home/ahmad/code/jsuz/javascript-tutorial-server/modules/markit/templates/codeTabs.pug line 1',
'Error: Pug file bemto.pug/lib/index from /home/ahmad/code/jsuz/javascript-tutorial-server/modules/markit/templates/codeTabs.pug not resolved\n at /home/ahmad/code/jsuz/javascript-tutorial-server/modules/markit/templates/codeTabs.pug line 1\n at Object.pugResolve [as resolve] (/home/ahmad/code/jsuz/javascript-tutorial-server/modules/pugResolve.js:34:13)\n at Object.resolve (/home/ahmad/code/jsuz/javascript-tutorial-server/node_modules/pug/lib/index.js:132:16)\n at /home/ahmad/code/jsuz/javascript-tutorial-server/node_modules/pug-load/index.js:22:26\n at walkAST (/home/ahmad/code/jsuz/javascript-tutorial-server/node_modules/pug-walk/index.js:23:18)\n at /home/ahmad/code/jsuz/javascript-tutorial-server/node_modules/pug-walk/index.js:104:20\n at Array.reduce ()\n at walkAndMergeNodes (/home/ahmad/code/jsuz/javascript-tutorial-server/node_modules/pug-walk/index.js:103:18)\n at walkAST (/home/ahmad/code/jsuz/javascript-tutorial-server/node_modules/pug-walk/index.js:37:19)\n at load (/home/ahmad/code/jsuz/javascript-tutorial-server/node_modules/pug-load/index.js:13:10)\n at Function.loadString [as string] (/home/ahmad/code/jsuz/javascript-tutorial-server/node_modules/pug-load/index.js:46:10)\n at compileBody (/home/ahmad/code/jsuz/javascript-tutorial-server/node_modules/pug/lib/index.js:86:18)\n at Object.exports.compile (/home/ahmad/code/jsuz/javascript-tutorial-server/node_modules/pug/lib/index.js:242:16)\n at Object.require.extensions..pug (/home/ahmad/code/jsuz/javascript-tutorial-server/modules/lib/serverPug/index.js:13:22)\n at Module.load (module.js:565:32)\n at tryModuleLoad (module.js:505:12)\n at Function.Module._load (module.js:497:3)' ]
(node:25863) DeprecationWarning: Tapable.plugin is deprecated. Use new API on
.hooks
instead [10:30:07] [webpack] Time: 4838ms Built at: 2018-07-21 10:30:07 Asset Size Chunks Chunk Names styles/blocks/font/icons.woff 14.6 KiB [emitted]styles/blocks/font/icons.otf 22.6 KiB [emitted]
styles/blocks/page-footer/slack.svg 1.49 KiB [emitted]
styles.css 85.7 KiB 0 [emitted] styles styles.js 1.13 KiB 0 [emitted] styles head.js 18.3 KiB 1 [emitted] head tutorial.js 34 KiB 2 [emitted] tutorial footer.js 4.59 KiB 3 [emitted] footer Entrypoint styles = styles.css styles.js Entrypoint head = head.js Entrypoint tutorial = tutorial.js Entrypoint footer = footer.js Child mini-css-extract-plugin node_modules/css-loader/index.js??ref--9-1!node_modules/postcss-loader/lib/index.js??ref--9-2!modules/hover-loader.js!node_modules/stylus-loader/index.js??ref--9-4!tmp/styles.styl: Asset Size Chunks Chunk Names styles/blocks/font/icons.woff 14.6 KiB [emitted]
styles/blocks/font/icons.otf 22.6 KiB [emitted]
styles/blocks/page-footer/slack.svg 1.49 KiB [emitted]
Entrypoint mini-css-extract-plugin = * [10:30:07] Finished 'client:webpack' after 5.04 s