Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'slice' of undefined #66

Open
JDEast1029 opened this issue Oct 14, 2019 · 4 comments
Open

TypeError: Cannot read property 'slice' of undefined #66

JDEast1029 opened this issue Oct 14, 2019 · 4 comments

Comments

@JDEast1029
Copy link

JDEast1029 commented Oct 14, 2019

ModuleBuildError: Module build failed (from ./node_modules/css-loader/dist/cjs.js):
20:07:31 TypeError: Cannot read property 'slice' of undefined
20:07:31 at css.each.node (/deployer210/workspace/xxx/node_modules/icss-utils/lib/extractICSS.js:23:25)
20:07:31 at Root.each (/deployer210/workspace/xxx/node_modules/postcss-loader/node_modules/postcss/lib/container.js:101:16)
20:07:31 at extractICSS (/deployer210/workspace/xxx/node_modules/icss-utils/lib/extractICSS.js:21:7)
20:07:31 at process (/deployer210/workspace/xxx/node_modules/css-loader/dist/plugins/postcss-icss-parser.js:22:43)
20:07:31 at LazyResult.run (/deployer210/workspace/xxx/node_modules/css-loader/node_modules/postcss/lib/lazy-result.js:295:14)
20:07:31 at LazyResult.asyncTick (/deployer210/workspace/xxx/node_modules/css-loader/node_modules/postcss/lib/lazy-result.js:208:26)
20:07:31 at LazyResult.asyncTick (/deployer210/workspace/xxx/node_modules/css-loader/node_modules/postcss/lib/lazy-result.js:221:14)
20:07:31 at LazyResult.asyncTick (/deployer210/workspace/xxx/node_modules/css-loader/node_modules/postcss/lib/lazy-result.js:221:14)
20:07:31 at processing.Promise.then._this2.processed (/deployer210/workspace/xxx/node_modules/css-loader/node_modules/postcss/lib/lazy-result.js:250:14)
20:07:31 at new Promise ()
20:07:31 at LazyResult.async (/deployer210/workspace/xxx/node_modules/css-loader/node_modules/postcss/lib/lazy-result.js:246:23)
20:07:31 at LazyResult.then (/deployer210/workspace/xxx/node_modules/css-loader/node_modules/postcss/lib/lazy-result.js:127:17)
20:07:31 at Object.loader (/deployer210/workspace/xxx/node_modules/css-loader/dist/index.js:131:6)
20:07:31 at runLoaders (/deployer210/workspace/xxx/node_modules/webpack/lib/NormalModule.js:301:20)
20:07:31 at /deployer210/workspace/xxx/node_modules/loader-runner/lib/LoaderRunner.js:367:11
20:07:31 at /deployer210/workspace/xxx/node_modules/loader-runner/lib/LoaderRunner.js:233:18
20:07:31 at context.callback (/deployer210/workspace/xxx/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
20:07:31 at process.then.catch.error (/deployer210/workspace/xxx/node_modules/css-loader/dist/index.js:258:5)
20:07:31 at

@alexander-akait
Copy link
Member

Please provide minimum reproducible test repo

@RISCfuture
Copy link

For me the error occurs on normalize.css: https://github.com/necolas/normalize.css/blob/master/normalize.css#L347

Looks like the parser is having issues with the [hidden] directive?

@alexander-akait
Copy link
Member

It is very strange, should be fined, maybe you can provide your setup?

@RISCfuture
Copy link

It happens with all of my Rails apps that use Webpacker. This is the webpack.js file as generated by Webpacker:

{
	"loaders": [
		{
			"key": "vue",
			"value": {
				"test": {},
				"use": [
					{
						"loader": "vue-loader"
					}
				]
			}
		},
		{
			"key": "typescript",
			"value": {
				"test": {},
				"use": [
					{
						"loader": "ts-loader",
						"options": {
							"appendTsSuffixTo": [
								{}
							]
						}
					}
				]
			}
		},
		{
			"key": "erb",
			"value": {
				"test": {},
				"enforce": "pre",
				"exclude": {},
				"use": [
					{
						"loader": "rails-erb-loader",
						"options": {
							"runner": "bin/rails runner"
						}
					}
				]
			}
		},
		{
			"key": "file",
			"value": {
				"test": {},
				"use": [
					{
						"loader": "file-loader",
						"options": {
							"context": "app/frontend"
						}
					}
				]
			}
		},
		{
			"key": "css",
			"value": {
				"test": {},
				"use": [
					"/Users/tmorgan/Local Documents/Programs/Rails/ranked/node_modules/mini-css-extract-plugin/dist/loader.js",
					{
						"loader": "css-loader",
						"options": {
							"sourceMap": true,
							"importLoaders": 2,
							"modules": false
						}
					},
					{
						"loader": "postcss-loader",
						"options": {
							"config": {
								"path": "/Users/tmorgan/Local Documents/Programs/Rails/ranked"
							},
							"sourceMap": true
						}
					}
				],
				"sideEffects": true,
				"exclude": {}
			}
		},
		{
			"key": "sass",
			"value": {
				"test": {},
				"use": [
					"/Users/tmorgan/Local Documents/Programs/Rails/ranked/node_modules/mini-css-extract-plugin/dist/loader.js",
					{
						"loader": "css-loader",
						"options": {
							"sourceMap": true,
							"importLoaders": 2,
							"modules": false
						}
					},
					{
						"loader": "postcss-loader",
						"options": {
							"config": {
								"path": "/Users/tmorgan/Local Documents/Programs/Rails/ranked"
							},
							"sourceMap": true
						}
					},
					{
						"loader": "sass-loader",
						"options": {
							"sourceMap": true
						}
					}
				],
				"sideEffects": true,
				"exclude": {}
			}
		},
		{
			"key": "moduleCss",
			"value": {
				"test": {},
				"use": [
					"/Users/tmorgan/Local Documents/Programs/Rails/ranked/node_modules/mini-css-extract-plugin/dist/loader.js",
					{
						"loader": "css-loader",
						"options": {
							"sourceMap": true,
							"importLoaders": 2,
							"modules": {
								"localIdentName": "[name]__[local]___[hash:base64:5]"
							}
						}
					},
					{
						"loader": "postcss-loader",
						"options": {
							"config": {
								"path": "/Users/tmorgan/Local Documents/Programs/Rails/ranked"
							},
							"sourceMap": true
						}
					}
				],
				"sideEffects": false,
				"include": {}
			}
		},
		{
			"key": "moduleSass",
			"value": {
				"test": {},
				"use": [
					"/Users/tmorgan/Local Documents/Programs/Rails/ranked/node_modules/mini-css-extract-plugin/dist/loader.js",
					{
						"loader": "css-loader",
						"options": {
							"sourceMap": true,
							"importLoaders": 2,
							"modules": {
								"localIdentName": "[name]__[local]___[hash:base64:5]"
							}
						}
					},
					{
						"loader": "postcss-loader",
						"options": {
							"config": {
								"path": "/Users/tmorgan/Local Documents/Programs/Rails/ranked"
							},
							"sourceMap": true
						}
					},
					{
						"loader": "sass-loader",
						"options": {
							"sourceMap": true
						}
					}
				],
				"sideEffects": false,
				"include": {}
			}
		},
		{
			"key": "nodeModules",
			"value": {
				"test": {},
				"include": {},
				"exclude": {},
				"use": [
					{
						"loader": "babel-loader",
						"options": {
							"babelrc": false,
							"presets": [
								[
									"@babel/preset-env",
									{
										"modules": false
									}
								]
							],
							"cacheDirectory": "tmp/cache/webpacker/babel-loader-node-modules",
							"cacheCompression": false,
							"compact": false,
							"sourceMaps": false
						}
					}
				]
			}
		},
		{
			"key": "babel",
			"value": {
				"test": {},
				"include": [
					"/Users/tmorgan/Local Documents/Programs/Rails/ranked/app/frontend"
				],
				"exclude": {},
				"use": [
					{
						"loader": "babel-loader",
						"options": {
							"cacheDirectory": "tmp/cache/webpacker/babel-loader-node-modules",
							"cacheCompression": false,
							"compact": false
						}
					}
				]
			}
		}
	],
	"plugins": [
		{
			"key": "VueLoaderPlugin",
			"value": {}
		},
		{
			"key": "Environment",
			"value": {
				"keys": [
					"TERM_PROGRAM",
					"SHELL",
					"TERM",
					"TERM_PROGRAM_VERSION",
					"TERM_SESSION_ID",
					"USER",
					"SSH_AUTH_SOCK",
					"PATH",
					"LaunchInstanceID",
					"PWD",
					"LANG",
					"XPC_FLAGS",
					"XPC_SERVICE_NAME",
					"SHLVL",
					"HOME",
					"LOGNAME",
					"SECURITYSESSIONID",
					"OLDPWD",
					"PAGER",
					"LESS",
					"PR_RED",
					"PR_GREEN",
					"PR_YELLOW",
					"PR_BLUE",
					"PR_WHITE",
					"PR_BLACK",
					"PR_CYAN",
					"PR_BOLD_RED",
					"PR_BOLD_GREEN",
					"PR_BOLD_YELLOW",
					"PR_BOLD_BLUE",
					"PR_BOLD_WHITE",
					"PR_BOLD_BLACK",
					"PR_BOLD_CYAN",
					"LSCOLORS",
					"GREP_OPTIONS",
					"HISTFILE",
					"HISTSIZE",
					"SAVEHIST",
					"EDITOR",
					"NVM_DIR",
					"NVM_CD_FLAGS",
					"NVM_BIN",
					"rvm_prefix",
					"rvm_path",
					"rvm_bin_path",
					"rvm_version",
					"MY_RUBY_HOME",
					"IRBRC",
					"RUBY_VERSION",
					"rvm_alias_expanded",
					"rvm_bin_flag",
					"rvm_docs_type",
					"rvm_gemstone_package_file",
					"rvm_gemstone_url",
					"rvm_niceness",
					"rvm_nightly_flag",
					"rvm_only_path_flag",
					"rvm_pretty_print_flag",
					"rvm_proxy",
					"rvm_quiet_flag",
					"rvm_ruby_bits",
					"rvm_ruby_file",
					"rvm_ruby_make",
					"rvm_ruby_make_install",
					"rvm_ruby_mode",
					"rvm_script_name",
					"rvm_sdk",
					"rvm_silent_flag",
					"rvm_use_flag",
					"GEM_HOME",
					"GEM_PATH",
					"TMPDIR",
					"rvm_delete_flag",
					"rvm_file_name",
					"rvm_ruby_alias",
					"rvm_sticky_flag",
					"rvm_system_flag",
					"rvm_user_flag",
					"rvm_ruby_string",
					"_",
					"__CF_USER_TEXT_ENCODING",
					"RAILS_ENV",
					"NODE_ENV",
					"BUNDLE_GEMFILE",
					"BUNDLER_ORIG_BUNDLE_BIN_PATH",
					"BUNDLER_ORIG_BUNDLE_GEMFILE",
					"BUNDLER_ORIG_BUNDLER_VERSION",
					"BUNDLER_ORIG_GEM_HOME",
					"BUNDLER_ORIG_GEM_PATH",
					"BUNDLER_ORIG_MANPATH",
					"BUNDLER_ORIG_PATH",
					"BUNDLER_ORIG_RB_USER_INSTALL",
					"BUNDLER_ORIG_RUBYLIB",
					"BUNDLER_ORIG_RUBYOPT",
					"BUNDLE_BIN_PATH",
					"BUNDLER_VERSION",
					"RUBYOPT",
					"RUBYLIB",
					"WEBPACK_DEV_SERVER"
				],
				"defaultValues": {
					"TERM_PROGRAM": "Apple_Terminal",
					"SHELL": "/usr/local/bin/zsh",
					"TERM": "xterm-256color",
					"TERM_PROGRAM_VERSION": "433",
					"TERM_SESSION_ID": "546C8E33-4452-403F-B13E-C93DCA14755C",
					"USER": "tmorgan",
					"SSH_AUTH_SOCK": "/private/tmp/com.apple.launchd.XuLUt12DQJ/Listeners",
					"PATH": "/Users/tmorgan/.rvm/gems/ruby-2.7.0@ranked/bin:/Users/tmorgan/.rvm/gems/ruby-2.7.0@global/bin:/Users/tmorgan/.rvm/rubies/ruby-2.7.0/bin:/Users/tmorgan/.rvm/bin:/Users/tmorgan/.nvm/versions/node/v12.14.0/bin:/Users/tmorgan/.cargo/bin:/usr/local/heroku/bin:/Users/tmorgan/.bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/Library/TeX/texbin",
					"LaunchInstanceID": "16BEA69D-FD6F-4C72-824C-740A8AB7B169",
					"PWD": "/Users/tmorgan/Local Documents/Programs/Rails/ranked",
					"LANG": "en_US.UTF-8",
					"XPC_FLAGS": "0x0",
					"XPC_SERVICE_NAME": "0",
					"SHLVL": "1",
					"HOME": "/Users/tmorgan",
					"LOGNAME": "tmorgan",
					"SECURITYSESSIONID": "186a6",
					"OLDPWD": "/Users/tmorgan/Local Documents/Programs/Rails/budgeting",
					"PAGER": "less",
					"LESS": "-R",
					"PR_RED": "%{\u001b[22;31m%}",
					"PR_GREEN": "%{\u001b[22;32m%}",
					"PR_YELLOW": "%{\u001b[22;33m%}",
					"PR_BLUE": "%{\u001b[22;34m%}",
					"PR_WHITE": "%{\u001b[22;37m%}",
					"PR_BLACK": "%{\u001b[22;30m%}",
					"PR_CYAN": "%{\u001b[22;36m%}",
					"PR_BOLD_RED": "%{\u001b[01;31m%}",
					"PR_BOLD_GREEN": "%{\u001b[01;32m%}",
					"PR_BOLD_YELLOW": "%{\u001b[01;33m%}",
					"PR_BOLD_BLUE": "%{\u001b[01;34m%}",
					"PR_BOLD_WHITE": "%{\u001b[01;37m%}",
					"PR_BOLD_BLACK": "%{\u001b[01;30m%}",
					"PR_BOLD_CYAN": "%{\u001b[01;36m%}",
					"LSCOLORS": "gxfxcxdxbxegedabagacad",
					"GREP_OPTIONS": "--color=auto",
					"HISTFILE": "/Users/tmorgan/.zhistory",
					"HISTSIZE": "100000",
					"SAVEHIST": "1000",
					"EDITOR": "vim",
					"NVM_DIR": "/Users/tmorgan/.nvm",
					"NVM_CD_FLAGS": "-q",
					"NVM_BIN": "/Users/tmorgan/.nvm/versions/node/v12.14.0/bin",
					"rvm_prefix": "/Users/tmorgan",
					"rvm_path": "/Users/tmorgan/.rvm",
					"rvm_bin_path": "/Users/tmorgan/.rvm/bin",
					"rvm_version": "1.29.9-next (master)",
					"MY_RUBY_HOME": "/Users/tmorgan/.rvm/rubies/ruby-2.7.0",
					"IRBRC": "/Users/tmorgan/.rvm/rubies/ruby-2.7.0/.irbrc",
					"RUBY_VERSION": "ruby-2.7.0",
					"rvm_alias_expanded": "",
					"rvm_bin_flag": "",
					"rvm_docs_type": "",
					"rvm_gemstone_package_file": "",
					"rvm_gemstone_url": "",
					"rvm_niceness": "",
					"rvm_nightly_flag": "",
					"rvm_only_path_flag": "",
					"rvm_pretty_print_flag": "",
					"rvm_proxy": "",
					"rvm_quiet_flag": "",
					"rvm_ruby_bits": "",
					"rvm_ruby_file": "",
					"rvm_ruby_make": "",
					"rvm_ruby_make_install": "",
					"rvm_ruby_mode": "",
					"rvm_script_name": "",
					"rvm_sdk": "",
					"rvm_silent_flag": "",
					"rvm_use_flag": "",
					"GEM_HOME": "/Users/tmorgan/.rvm/gems/ruby-2.7.0@ranked",
					"GEM_PATH": "/Users/tmorgan/.rvm/gems/ruby-2.7.0@ranked:/Users/tmorgan/.rvm/gems/ruby-2.7.0@global",
					"TMPDIR": "/var/folders/yg/rmm950jd6sv_g2wdyjgs8m7h0000gn/T/",
					"rvm_delete_flag": "0",
					"rvm_file_name": "",
					"rvm_ruby_alias": "",
					"rvm_sticky_flag": "",
					"rvm_system_flag": "",
					"rvm_user_flag": "",
					"rvm_ruby_string": "ruby-2.7.0",
					"_": "/Users/tmorgan/Local Documents/Programs/Rails/ranked/bin/webpack-dev-server",
					"__CF_USER_TEXT_ENCODING": "0x1F5:0x0:0x0",
					"RAILS_ENV": "development",
					"NODE_ENV": "development",
					"BUNDLE_GEMFILE": "/Users/tmorgan/Local Documents/Programs/Rails/ranked/Gemfile",
					"BUNDLER_ORIG_BUNDLE_BIN_PATH": "BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL",
					"BUNDLER_ORIG_BUNDLE_GEMFILE": "/Users/tmorgan/Local Documents/Programs/Rails/ranked/Gemfile",
					"BUNDLER_ORIG_BUNDLER_VERSION": "BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL",
					"BUNDLER_ORIG_GEM_HOME": "/Users/tmorgan/.rvm/gems/ruby-2.7.0@ranked",
					"BUNDLER_ORIG_GEM_PATH": "/Users/tmorgan/.rvm/gems/ruby-2.7.0@ranked:/Users/tmorgan/.rvm/gems/ruby-2.7.0@global",
					"BUNDLER_ORIG_MANPATH": "BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL",
					"BUNDLER_ORIG_PATH": "/Users/tmorgan/.rvm/gems/ruby-2.7.0@ranked/bin:/Users/tmorgan/.rvm/gems/ruby-2.7.0@global/bin:/Users/tmorgan/.rvm/rubies/ruby-2.7.0/bin:/Users/tmorgan/.rvm/bin:/Users/tmorgan/.nvm/versions/node/v12.14.0/bin:/Users/tmorgan/.cargo/bin:/usr/local/heroku/bin:/Users/tmorgan/.bin:/usr/local/bin:/usr/local/sbin:/Users/tmorgan/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/Library/TeX/texbin",
					"BUNDLER_ORIG_RB_USER_INSTALL": "BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL",
					"BUNDLER_ORIG_RUBYLIB": "BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL",
					"BUNDLER_ORIG_RUBYOPT": "BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL",
					"BUNDLE_BIN_PATH": "/Users/tmorgan/.rvm/rubies/ruby-2.7.0/lib/ruby/gems/2.7.0/gems/bundler-2.1.2/exe/bundle",
					"BUNDLER_VERSION": "2.1.2",
					"RUBYOPT": "-r/Users/tmorgan/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/bundler/setup",
					"RUBYLIB": "",
					"WEBPACK_DEV_SERVER": "true"
				}
			}
		},
		{
			"key": "CaseSensitivePaths",
			"value": {
				"options": {},
				"pathCache": {},
				"fsOperations": 0,
				"primed": false
			}
		},
		{
			"key": "MiniCssExtract",
			"value": {
				"options": {
					"filename": "css/[name]-[contenthash:8].css",
					"ignoreOrder": false,
					"chunkFilename": "css/[name]-[contenthash:8].chunk.css"
				}
			}
		},
		{
			"key": "Manifest",
			"value": {}
		}
	],
	"config": {
		"mode": "development",
		"output": {
			"filename": "js/[name]-[contenthash].js",
			"chunkFilename": "js/[name]-[contenthash].chunk.js",
			"hotUpdateChunkFilename": "js/[id]-[hash].hot-update.js",
			"path": "/Users/tmorgan/Local Documents/Programs/Rails/ranked/public/packs",
			"publicPath": "/packs/",
			"pathinfo": true
		},
		"resolve": {
			"extensions": [
				".vue",
				".tsx",
				".ts",
				".erb",
				".mjs",
				".js",
				".sass",
				".scss",
				".css",
				".module.sass",
				".module.scss",
				".module.css",
				".png",
				".svg",
				".gif",
				".jpeg",
				".jpg"
			],
			"plugins": [
				{
					"topLevelLoader": {}
				}
			]
		},
		"resolveLoader": {
			"modules": [
				"node_modules"
			],
			"plugins": [
				{}
			]
		},
		"node": {
			"dgram": "empty",
			"fs": "empty",
			"net": "empty",
			"tls": "empty",
			"child_process": "empty"
		},
		"cache": true,
		"devtool": "cheap-module-source-map",
		"devServer": {
			"clientLogLevel": "none",
			"compress": true,
			"quiet": false,
			"disableHostCheck": true,
			"host": "localhost",
			"port": 3035,
			"https": false,
			"hot": false,
			"contentBase": "/Users/tmorgan/Local Documents/Programs/Rails/ranked/public/packs",
			"inline": true,
			"useLocalIp": false,
			"public": "localhost:3035",
			"publicPath": "/packs/",
			"historyApiFallback": {
				"disableDotRule": true
			},
			"headers": {
				"Access-Control-Allow-Origin": "*"
			},
			"overlay": true,
			"stats": {
				"entrypoints": false,
				"errorDetails": true,
				"modules": false,
				"moduleTrace": false
			},
			"watchOptions": {
				"ignored": "**/node_modules/**"
			}
		}
	},
	"entry": {
		"application": "/Users/tmorgan/Local Documents/Programs/Rails/ranked/app/frontend/packs/application.ts"
	},
	"resolvedModules": [
		{
			"key": "source",
			"value": "/Users/tmorgan/Local Documents/Programs/Rails/ranked/app/frontend"
		},
		{
			"key": "node_modules",
			"value": "node_modules"
		}
	]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants