maoberlehner / node-sass-magic-importer

Custom node-sass importer for selector specific imports, module importing, globbing support and importing files only once.
MIT License
292 stars 28 forks source link

TypeError: this.store[storeKey].includes is not a function #118

Closed kflu closed 7 years ago

kflu commented 7 years ago

Getting this error (node-sass-magic-importer@4.1.5) when using hexo generate.

C:\Users\work\blog\node_modules\node-sass-magic-importer\dist\index.js:133
      if (!hasFilters && this.store[storeKey] && this.store[storeKey].includes(absoluteUrl)) {
                                                                      ^

TypeError: this.store[storeKey].includes is not a function
    at MagicImporter.isInStore (C:\Users\work\blog\node_modules\node-sass-magic-importer\dist\index.js:133:71)
    at MagicImporter.resolveSync (C:\Users\work\blog\node_modules\node-sass-magic-importer\dist\index.js:199:16)
    at Object.importer (C:\Users\work\blog\node_modules\node-sass-magic-importer\dist\index.js:296:26)
    at options.importer (C:\Users\work\blog\node_modules\node-sass\lib\index.js:331:31)

This issue also reports the same thing (sass/node-sass/issues/2039).

Below are detail info about my node environment. Is there any workaround?

PS C:\Users\work\blog> node --version
v5.6.0
PS C:\Users\work\blog> npm --version
3.6.0
PS> npm ls

hexo-site@0.0.0 C:\Users\work\blog
+-- hexo@3.3.7
| +-- abbrev@1.1.0
| +-- archy@1.0.0
| +-- bluebird@3.5.0
| +-- chalk@1.1.3
| | +-- ansi-styles@2.2.1
| | +-- escape-string-regexp@1.0.5
| | +-- has-ansi@2.0.0
| | | `-- ansi-regex@2.1.1
| | +-- strip-ansi@3.0.1
| | `-- supports-color@2.0.0
| +-- cheerio@0.20.0
| | +-- css-select@1.2.0
| | | +-- boolbase@1.0.0
| | | +-- css-what@2.1.0
| | | +-- domutils@1.5.1
| | | `-- nth-check@1.0.1
| | +-- dom-serializer@0.1.0
| | | `-- domelementtype@1.1.3
| | +-- entities@1.1.1
| | +-- htmlparser2@3.8.3
| | | +-- domelementtype@1.3.0
| | | +-- domhandler@2.3.0
| | | +-- entities@1.0.0
| | | `-- readable-stream@1.1.14
| | |   +-- core-util-is@1.0.2
| | |   +-- isarray@0.0.1
| | |   `-- string_decoder@0.10.31
| | `-- jsdom@7.2.2
| |   +-- abab@1.0.3
| |   +-- acorn@2.7.0
| |   +-- acorn-globals@1.0.9
| |   +-- cssom@0.3.2
| |   +-- cssstyle@0.2.37
| |   +-- escodegen@1.8.1
| |   | +-- esprima@2.7.3
| |   | +-- estraverse@1.9.3
| |   | +-- esutils@2.0.2
| |   | +-- optionator@0.8.2
| |   | | +-- deep-is@0.1.3
| |   | | +-- fast-levenshtein@2.0.6
| |   | | +-- levn@0.3.0
| |   | | +-- prelude-ls@1.1.2
| |   | | +-- type-check@0.3.2
| |   | | `-- wordwrap@1.0.0
| |   | `-- source-map@0.2.0
| |   +-- nwmatcher@1.4.1
| |   +-- parse5@1.5.1
| |   +-- sax@1.2.4
| |   +-- symbol-tree@3.2.2
| |   +-- tough-cookie@2.3.2
| |   | `-- punycode@1.4.1
| |   +-- webidl-conversions@2.0.1
| |   +-- whatwg-url-compat@0.6.5
| |   | `-- tr46@0.0.3
| |   `-- xml-name-validator@2.0.1
| +-- deep-assign@2.0.0
| | `-- is-obj@1.0.1
| +-- hexo-front-matter@0.2.3
| +-- hexo-fs@0.1.6
| | +-- chokidar@1.7.0
| | | +-- anymatch@1.3.0
| | | | +-- arrify@1.0.1
| | | | `-- micromatch@2.3.11
| | | |   +-- arr-diff@2.0.0
| | | |   | `-- arr-flatten@1.1.0
| | | |   +-- array-unique@0.2.1
| | | |   +-- braces@1.8.5
| | | |   | +-- expand-range@1.8.2
| | | |   | | `-- fill-range@2.2.3
| | | |   | |   +-- is-number@2.1.0
| | | |   | |   +-- isobject@2.1.0
| | | |   | |   | `-- isarray@1.0.0
| | | |   | |   +-- randomatic@1.1.7
| | | |   | |   | +-- is-number@3.0.0
| | | |   | |   | | `-- kind-of@3.2.2
| | | |   | |   | `-- kind-of@4.0.0
| | | |   | |   `-- repeat-string@1.6.1
| | | |   | +-- preserve@0.2.0
| | | |   | `-- repeat-element@1.1.2
| | | |   +-- expand-brackets@0.1.5
| | | |   | `-- is-posix-bracket@0.1.1
| | | |   +-- extglob@0.3.2
| | | |   +-- filename-regex@2.0.1
| | | |   +-- kind-of@3.2.2
| | | |   | `-- is-buffer@1.1.5
| | | |   +-- normalize-path@2.1.1
| | | |   | `-- remove-trailing-separator@1.0.2
| | | |   +-- object.omit@2.0.1
| | | |   | +-- for-own@0.1.5
| | | |   | | `-- for-in@1.0.2
| | | |   | `-- is-extendable@0.1.1
| | | |   +-- parse-glob@3.0.4
| | | |   | +-- glob-base@0.3.0
| | | |   | `-- is-dotfile@1.0.3
| | | |   `-- regex-cache@0.4.3
| | | |     +-- is-equal-shallow@0.1.3
| | | |     `-- is-primitive@2.0.0
| | | +-- async-each@1.0.1
| | | +-- UNMET OPTIONAL DEPENDENCY fsevents@^1.0.0
| | | +-- glob-parent@2.0.0
| | | +-- inherits@2.0.3
| | | +-- is-binary-path@1.0.1
| | | | `-- binary-extensions@1.8.0
| | | +-- is-glob@2.0.1
| | | | `-- is-extglob@1.0.0
| | | +-- path-is-absolute@1.0.1
| | | `-- readdirp@2.1.0
| | |   +-- readable-stream@2.3.3
| | |   | +-- isarray@1.0.0
| | |   | +-- process-nextick-args@1.0.7
| | |   | +-- string_decoder@1.0.3
| | |   | `-- util-deprecate@1.0.2
| | |   `-- set-immediate-shim@1.0.1
| | `-- graceful-fs@4.1.11
| +-- hexo-i18n@0.2.1
| | `-- sprintf-js@1.0.3
| +-- hexo-log@0.1.3
| | `-- bunyan@1.8.10
| |   +-- dtrace-provider@0.8.3
| |   +-- mv@2.1.1
| |   | `-- ncp@2.0.0
| |   `-- safe-json-stringify@1.0.4
| +-- hexo-util@0.6.0
| | +-- camel-case@3.0.0
| | | +-- no-case@2.3.1
| | | | `-- lower-case@1.1.4
| | | `-- upper-case@1.1.3
| | +-- cross-spawn@4.0.2
| | | +-- lru-cache@4.1.1
| | | | +-- pseudomap@1.0.2
| | | | `-- yallist@2.1.2
| | | `-- which@1.2.14
| | |   `-- isexe@2.0.0
| | +-- highlight.js@9.12.0
| | +-- html-entities@1.2.1
| | `-- striptags@2.2.1
| +-- js-yaml@3.8.4
| | +-- argparse@1.0.9
| | `-- esprima@3.1.3
| +-- lodash@4.17.4
| +-- minimatch@3.0.4
| | `-- brace-expansion@1.1.8
| |   +-- balanced-match@1.0.0
| |   `-- concat-map@0.0.1
| +-- moment@2.13.0
| +-- moment-timezone@0.5.13
| +-- nunjucks@2.5.2
| | +-- asap@2.0.5
| | `-- yargs@3.32.0
| |   +-- camelcase@2.1.1
| |   +-- cliui@3.2.0
| |   | `-- wrap-ansi@2.1.0
| |   +-- decamelize@1.2.0
| |   +-- os-locale@1.4.0
| |   | `-- lcid@1.0.0
| |   |   `-- invert-kv@1.0.0
| |   +-- string-width@1.0.2
| |   | +-- code-point-at@1.1.0
| |   | `-- is-fullwidth-code-point@1.0.0
| |   |   `-- number-is-nan@1.0.1
| |   +-- window-size@0.1.4
| |   `-- y18n@3.2.1
| +-- pretty-hrtime@1.0.3
| +-- strip-indent@1.0.1
| | `-- get-stdin@4.0.1
| +-- swig@1.4.2
| | +-- optimist@0.6.1
| | | +-- minimist@0.0.10
| | | `-- wordwrap@0.0.3
| | `-- uglify-js@2.4.24
| |   +-- async@0.2.10
| |   +-- source-map@0.1.34
| |   +-- uglify-to-browserify@1.0.2
| |   `-- yargs@3.5.4
| |     +-- camelcase@1.2.1
| |     +-- window-size@0.1.0
| |     `-- wordwrap@0.0.2
| +-- swig-extras@0.0.1
| | `-- markdown@0.5.0
| |   `-- nopt@2.1.2
| +-- text-table@0.2.0
| +-- tildify@1.2.0
| | `-- os-homedir@1.0.2
| +-- titlecase@1.1.2
| `-- warehouse@2.2.0
|   +-- cuid@1.3.8
|   | +-- browser-fingerprint@0.0.1
|   | +-- core-js@1.2.7
|   | `-- node-fingerprint@0.0.2
|   +-- is-plain-object@2.0.3
|   | `-- isobject@3.0.1
|   `-- JSONStream@1.3.1
|     +-- jsonparse@1.3.1
|     `-- through@2.3.8
+-- hexo-cli@1.0.3
| +-- command-exists@1.2.2
| +-- hexo-fs@0.2.0
| +-- minimist@1.2.0
| `-- object-assign@4.1.1
+-- hexo-deployer-git@0.2.0
+-- hexo-generator-archive@0.1.4
| +-- hexo-pagination@0.0.2
| | `-- utils-merge@1.0.0
| `-- object-assign@2.1.1
+-- hexo-generator-category@0.1.3
| +-- hexo-pagination@0.0.2
| `-- object-assign@2.1.1
+-- hexo-generator-index@0.2.1
| `-- hexo-pagination@0.0.2
+-- hexo-generator-robotstxt@0.2.0
+-- hexo-generator-tag@0.2.0
| `-- hexo-pagination@0.0.2
+-- hexo-pagination@0.1.0
+-- hexo-renderer-ejs@0.2.0
| `-- ejs@1.0.0
+-- hexo-renderer-markdown-it@3.4.1
| +-- lodash.assign@3.2.0
| | +-- lodash._baseassign@3.2.0
| | | `-- lodash._basecopy@3.0.1
| | +-- lodash._createassigner@3.1.1
| | | +-- lodash._bindcallback@3.0.1
| | | +-- lodash._isiterateecall@3.0.9
| | | `-- lodash.restparam@3.6.1
| | `-- lodash.keys@3.1.2
| |   +-- lodash._getnative@3.9.1
| |   +-- lodash.isarguments@3.1.0
| |   `-- lodash.isarray@3.0.4
| +-- markdown-it@5.1.0
| | +-- linkify-it@1.2.4
| | +-- mdurl@1.0.1
| | `-- uc.micro@1.0.3
| +-- markdown-it-abbr@1.0.4
| +-- markdown-it-footnote@2.0.0
| +-- markdown-it-ins@2.0.0
| +-- markdown-it-sub@1.0.0
| +-- markdown-it-sup@1.0.0
| `-- sluggo@0.2.0
+-- hexo-renderer-scss@1.0.3
| +-- node-sass@3.13.1
| | +-- async-foreach@0.1.3
| | +-- cross-spawn@3.0.1
| | +-- gaze@1.1.2
| | | `-- globule@1.2.0
| | |   `-- glob@7.1.2
| | +-- glob@7.1.2
| | | +-- fs.realpath@1.0.0
| | | +-- inflight@1.0.6
| | | | `-- wrappy@1.0.2
| | | `-- once@1.4.0
| | +-- in-publish@2.0.0
| | +-- lodash.assign@4.2.0
| | +-- lodash.clonedeep@4.5.0
| | +-- meow@3.7.0
| | | +-- camelcase-keys@2.1.0
| | | +-- loud-rejection@1.6.0
| | | | +-- currently-unhandled@0.4.1
| | | | | `-- array-find-index@1.0.2
| | | | `-- signal-exit@3.0.2
| | | +-- map-obj@1.0.1
| | | +-- normalize-package-data@2.4.0
| | | | +-- hosted-git-info@2.5.0
| | | | +-- is-builtin-module@1.0.0
| | | | | `-- builtin-modules@1.1.1
| | | | `-- validate-npm-package-license@3.0.1
| | | |   +-- spdx-correct@1.0.2
| | | |   | `-- spdx-license-ids@1.2.2
| | | |   `-- spdx-expression-parse@1.0.4
| | | +-- read-pkg-up@1.0.1
| | | | +-- find-up@1.1.2
| | | | | `-- path-exists@2.1.0
| | | | `-- read-pkg@1.1.0
| | | |   +-- load-json-file@1.1.0
| | | |   | +-- parse-json@2.2.0
| | | |   | | `-- error-ex@1.3.1
| | | |   | |   `-- is-arrayish@0.2.1
| | | |   | +-- pify@2.3.0
| | | |   | `-- strip-bom@2.0.0
| | | |   |   `-- is-utf8@0.2.1
| | | |   `-- path-type@1.1.0
| | | +-- redent@1.0.0
| | | | `-- indent-string@2.1.0
| | | |   `-- repeating@2.0.1
| | | |     `-- is-finite@1.0.2
| | | `-- trim-newlines@1.0.0
| | +-- mkdirp@0.5.1
| | | `-- minimist@0.0.8
| | +-- nan@2.6.2
| | +-- node-gyp@3.6.2
| | | +-- fstream@1.0.11
| | | +-- glob@7.1.2
| | | +-- osenv@0.1.4
| | | | `-- os-tmpdir@1.0.2
| | | +-- rimraf@2.4.5
| | | | `-- glob@6.0.4
| | | +-- semver@5.3.0
| | | `-- tar@2.2.1
| | |   `-- block-stream@0.0.9
| | +-- npmlog@4.1.2
| | | +-- are-we-there-yet@1.1.4
| | | | +-- delegates@1.0.0
| | | | `-- readable-stream@2.3.3
| | | |   +-- isarray@1.0.0
| | | |   `-- string_decoder@1.0.3
| | | +-- console-control-strings@1.1.0
| | | +-- gauge@2.7.4
| | | | +-- aproba@1.1.2
| | | | +-- has-unicode@2.0.1
| | | | `-- wide-align@1.1.2
| | | `-- set-blocking@2.0.0
| | +-- request@2.81.0
| | | +-- aws-sign2@0.6.0
| | | +-- aws4@1.6.0
| | | +-- caseless@0.12.0
| | | +-- combined-stream@1.0.5
| | | | `-- delayed-stream@1.0.0
| | | +-- extend@3.0.1
| | | +-- forever-agent@0.6.1
| | | +-- form-data@2.1.4
| | | | `-- asynckit@0.4.0
| | | +-- har-validator@4.2.1
| | | | +-- ajv@4.11.8
| | | | | +-- co@4.6.0
| | | | | `-- json-stable-stringify@1.0.1
| | | | |   `-- jsonify@0.0.0
| | | | `-- har-schema@1.0.5
| | | +-- hawk@3.1.3
| | | | +-- boom@2.10.1
| | | | +-- cryptiles@2.0.5
| | | | +-- hoek@2.16.3
| | | | `-- sntp@1.0.9
| | | +-- http-signature@1.1.1
| | | | +-- assert-plus@0.2.0
| | | | +-- jsprim@1.4.0
| | | | | +-- assert-plus@1.0.0
| | | | | +-- extsprintf@1.0.2
| | | | | +-- json-schema@0.2.3
| | | | | `-- verror@1.3.6
| | | | `-- sshpk@1.13.1
| | | |   +-- asn1@0.2.3
| | | |   +-- assert-plus@1.0.0
| | | |   +-- bcrypt-pbkdf@1.0.1
| | | |   +-- dashdash@1.14.1
| | | |   | `-- assert-plus@1.0.0
| | | |   +-- ecc-jsbn@0.1.1
| | | |   +-- getpass@0.1.7
| | | |   | `-- assert-plus@1.0.0
| | | |   +-- jsbn@0.1.1
| | | |   `-- tweetnacl@0.14.5
| | | +-- is-typedarray@1.0.0
| | | +-- isstream@0.1.2
| | | +-- json-stringify-safe@5.0.1
| | | +-- mime-types@2.1.15
| | | +-- oauth-sign@0.8.2
| | | +-- performance-now@0.2.0
| | | +-- qs@6.4.0
| | | +-- safe-buffer@5.1.1
| | | +-- stringstream@0.0.5
| | | +-- tunnel-agent@0.6.0
| | | `-- uuid@3.1.0
| | `-- sass-graph@2.2.4
| |   +-- glob@7.1.2
| |   +-- scss-tokenizer@0.2.3
| |   | +-- js-base64@2.1.9
| |   | `-- source-map@0.4.4
| |   `-- yargs@7.1.0
| |     +-- camelcase@3.0.0
| |     +-- get-caller-file@1.0.2
| |     +-- require-directory@2.1.1
| |     +-- require-main-filename@1.0.1
| |     +-- which-module@1.0.0
| |     `-- yargs-parser@5.0.0
| |       `-- camelcase@3.0.0
| `-- node-sass-magic-importer@4.1.5
|   +-- css-node-extract@0.2.3
|   | `-- postcss@6.0.6
|   |   +-- chalk@2.0.1
|   |   | `-- ansi-styles@3.1.0
|   |   |   `-- color-convert@1.9.0
|   |   |     `-- color-name@1.1.2
|   |   +-- source-map@0.5.6
|   |   `-- supports-color@4.2.0
|   |     `-- has-flag@2.0.0
|   +-- glob@7.1.2
|   +-- node-sass-filter-importer@1.0.1
|   | `-- css-node-extract@0.1.0
|   |   `-- postcss@5.2.17
|   |     +-- source-map@0.5.6
|   |     `-- supports-color@3.2.3
|   |       `-- has-flag@1.0.0
|   +-- node-sass-glob-importer@3.0.2
|   | `-- glob@7.1.2
|   +-- node-sass-package-importer@3.0.4
|   | `-- resolve@1.3.3
|   |   `-- path-parse@1.0.5
|   +-- node-sass-selector-importer@4.2.1
|   | +-- css-selector-extract@2.0.6
|   | `-- postcss-scss@0.3.1
|   |   `-- postcss@5.2.17
|   |     +-- source-map@0.5.6
|   |     `-- supports-color@3.2.3
|   |       `-- has-flag@1.0.0
|   +-- postcss-scss@0.4.1
|   | `-- postcss@5.2.17
|   |   +-- source-map@0.5.6
|   |   `-- supports-color@3.2.3
|   |     `-- has-flag@1.0.0
|   `-- unique-concat@0.2.2
+-- hexo-renderer-stylus@0.3.3
| +-- nib@1.1.2
| `-- stylus@0.54.5
|   +-- css-parse@1.7.0
|   +-- debug@2.6.8
|   | `-- ms@2.0.0
|   +-- glob@7.0.6
|   +-- sax@0.5.8
|   `-- source-map@0.1.43
|     `-- amdefine@1.0.1
`-- hexo-server@0.2.1
  +-- compression@1.6.2
  | +-- accepts@1.3.3
  | | `-- negotiator@0.6.1
  | +-- bytes@2.3.0
  | +-- compressible@2.0.10
  | | `-- mime-db@1.27.0
  | +-- debug@2.2.0
  | | `-- ms@0.7.1
  | +-- on-headers@1.0.1
  | `-- vary@1.1.1
  +-- connect@3.6.2
  | +-- debug@2.6.7
  | +-- finalhandler@1.0.3
  | | +-- debug@2.6.7
  | | +-- statuses@1.3.1
  | | `-- unpipe@1.0.0
  | `-- parseurl@1.3.1
  +-- mime@1.3.6
  +-- morgan@1.8.2
  | +-- basic-auth@1.1.0
  | +-- depd@1.1.0
  | `-- on-finished@2.3.0
  |   `-- ee-first@1.1.1
  +-- opn@4.0.2
  | `-- pinkie-promise@2.0.1
  |   `-- pinkie@2.0.4
  `-- serve-static@1.12.3
    +-- encodeurl@1.0.1
    +-- escape-html@1.0.3
    `-- send@0.15.3
      +-- debug@2.6.7
      +-- destroy@1.0.4
      +-- etag@1.8.0
      +-- fresh@0.5.0
      +-- http-errors@1.6.1
      | `-- setprototypeof@1.0.3
      +-- mime@1.3.4
      `-- range-parser@1.2.0
maoberlehner commented 7 years ago

Thank you for the detailed bug report and for using node-sass-magic-importer. Pleas update your Node.js version to at least 6.x or to the latest version which is 8.x and the problem will be gone.

I will add a Node.js version requirement to the package.json of this project in the near future – there is already an issue addressing this: https://github.com/maoberlehner/node-sass-magic-importer/issues/117

I hope updating your Node.js environment is no problem for you. Because I'm working on this project in my free time, I'm not planning to support older versions than 6.x (which is a LTS release).

Thanks.

kflu commented 7 years ago

Thanks. node 6.0 makes this work. This is fortunately, because there's another unrelated bug in node-sass that prevents me from using a later version of node. But it's fortunate that node 6.0 lies in the range where it happens to work.