请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

css-loader 安装问题再续

重新下载了个 webpack 4.x 版本(npm install webpack -g)却在指定下载本地 npm install webpack@1.15.0 --save-dev 版本的下载不了
以下 Bash 输出结果

$ npm install webpack@1.15.0 --save-dev
mmall-fe@1.0.0 C:UsersASUSmmalldocmmall-fe
-- webpack@1.15.0 +-- acorn@3.3.0 +-- async@1.5.2 +-- clone@1.0.4 +-- enhanced-resolve@0.9.1 | +-- graceful-fs@4.1.11 |– memory-fs@0.2.0
±- interpret@0.6.6
±- loader-utils@0.2.17
| ±- big.js@3.2.0
| ±- emojis-list@2.1.0
| ±- json5@0.5.1
| -- object-assign@4.1.1 +-- memory-fs@0.3.0 | +-- errno@0.1.7 | |– prr@1.0.1
| -- readable-stream@2.3.6 | +-- core-util-is@1.0.2 | +-- inherits@2.0.3 | +-- isarray@1.0.0 | +-- process-nextick-args@2.0.0 | +-- safe-buffer@5.1.2 | +-- string_decoder@1.1.1 |– util-deprecate@1.0.2
±- mkdirp@0.5.1
| -- minimist@0.0.8 +-- node-libs-browser@0.7.0 | +-- assert@1.4.1 | |– util@0.10.3
| | -- inherits@2.0.1 | +-- browserify-zlib@0.1.4 | |– pako@0.2.9
| ±- buffer@4.9.1
| | ±- base64-js@1.3.0
| | -- ieee754@1.1.12 | +-- console-browserify@1.1.0 | |– date-now@0.1.4
| ±- constants-browserify@1.0.0
| ±- crypto-browserify@3.3.0
| | ±- browserify-aes@0.4.0
| | ±- pbkdf2-compat@2.0.1
| | ±- ripemd160@0.2.0
| | -- sha.js@2.2.6 | +-- domain-browser@1.2.0 | +-- events@1.1.1 | +-- https-browserify@0.0.1 | +-- os-browserify@0.2.1 | +-- path-browserify@0.0.0 | +-- process@0.11.10 | +-- punycode@1.4.1 | +-- querystring-es3@0.2.1 | +-- stream-browserify@2.0.1 | +-- stream-http@2.8.3 | | +-- builtin-status-codes@3.0.0 | | +-- to-arraybuffer@1.0.1 | |– xtend@4.0.1
| ±- string_decoder@0.10.31
| ±- timers-browserify@2.0.10
| | -- setimmediate@1.0.5 | +-- tty-browserify@0.0.0 | +-- url@0.11.0 | | +-- punycode@1.3.2 | |– querystring@0.2.0
| ±- util@0.10.4
| -- vm-browserify@0.0.4 |– indexof@0.0.1
±- optimist@0.6.1
| -- wordwrap@0.0.3 +-- supports-color@3.2.3 |– has-flag@1.0.0
±- tapable@0.1.10
±- uglify-js@2.7.5
| ±- async@0.2.10
| ±- source-map@0.5.7
| ±- uglify-to-browserify@1.0.2
| -- yargs@3.10.0 | +-- camelcase@1.2.1 | +-- cliui@2.1.0 | | +-- center-align@0.1.3 | | | +-- align-text@0.1.4 | | | | +-- longest@1.0.1 | | | |– repeat-string@1.6.1
| | | -- lazy-cache@1.0.4 | | +-- right-align@0.1.3 | |– wordwrap@0.0.2
| ±- decamelize@1.2.0
| -- window-size@0.1.0 +-- watchpack@0.2.9 | +-- async@0.9.2 |– chokidar@1.7.0
| ±- anymatch@1.3.2
| | ±- 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.4
| | | | | ±- is-number@2.1.0
| | | | | ±- isobject@2.1.0
| | | | | -- randomatic@3.1.0 | | | | | +-- is-number@4.0.0 | | | | | +-- kind-of@6.0.2 | | | | |– math-random@1.0.1
| | | | ±- preserve@0.2.0
| | | | -- repeat-element@1.1.3 | | | +-- 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.6 | | | +-- 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.4 | | |– is-equal-shallow@0.1.3
| | | -- is-primitive@2.0.0 | |– normalize-path@2.1.1
| | -- remove-trailing-separator@1.1.0 | +-- async-each@1.0.1 | +-- glob-parent@2.0.0 | +-- is-binary-path@1.0.1 | |– binary-extensions@1.12.0
| ±- is-glob@2.0.1
| | -- is-extglob@1.0.0 | +-- path-is-absolute@1.0.1 |– readdirp@2.2.1
| -- micromatch@3.1.10 | +-- arr-diff@4.0.0 | +-- array-unique@0.3.2 | +-- braces@2.3.2 | | +-- extend-shallow@2.0.1 | | +-- fill-range@4.0.0 | | | +-- extend-shallow@2.0.1 | | | +-- is-number@3.0.0 | | | |– kind-of@3.2.2
| | | -- to-regex-range@2.1.1 | | |– is-number@3.0.0
| | ±- isobject@3.0.1
| | ±- snapdragon-node@2.1.1
| | | ±- define-property@1.0.0
| | | | -- is-descriptor@1.0.2 | | | | +-- is-accessor-descriptor@1.0.0 | | | | +-- is-data-descriptor@1.0.0 | | | |– kind-of@6.0.2
| | | ±- isobject@3.0.1
| | | -- snapdragon-util@3.0.1 | |– split-string@3.1.0
| ±- define-property@2.0.2
| | ±- is-descriptor@1.0.2
| | | ±- is-accessor-descriptor@1.0.0
| | | ±- is-data-descriptor@1.0.0
| | | -- kind-of@6.0.2 | |– isobject@3.0.1
| ±- extend-shallow@3.0.2
| | ±- assign-symbols@1.0.0
| | -- is-extendable@1.0.1 | |– is-plain-object@2.0.4
| | -- isobject@3.0.1 | +-- extglob@2.0.4 | | +-- define-property@1.0.0 | | |– is-descriptor@1.0.2
| | | ±- is-accessor-descriptor@1.0.0
| | | -- is-data-descriptor@1.0.0 | | +-- expand-brackets@2.1.4 | | | +-- define-property@0.2.5 | | | |– is-descriptor@0.1.6
| | | | ±- is-accessor-descriptor@0.1.6
| | | | | -- kind-of@3.2.2 | | | | +-- is-data-descriptor@0.1.4 | | | | |– kind-of@3.2.2
| | | | -- kind-of@5.1.0 | | | +-- extend-shallow@2.0.1 | | |– posix-character-classes@0.1.1
| | -- extend-shallow@2.0.1 | +-- fragment-cache@0.2.1 | |– map-cache@0.2.2
| ±- kind-of@6.0.2
| ±- nanomatch@1.2.13
| | ±- arr-diff@4.0.0
| | ±- array-unique@0.3.2
| | ±- is-windows@1.0.2
| | -- kind-of@6.0.2 | +-- object.pick@1.3.0 | |– isobject@3.0.1
| ±- regex-not@1.0.2
| | -- safe-regex@1.1.0 | |– ret@0.1.15
| ±- snapdragon@0.8.2
| | ±- base@0.11.2
| | | ±- cache-base@1.0.1
| | | | ±- collection-visit@1.0.0
| | | | | ±- map-visit@1.0.0
| | | | | -- object-visit@1.0.1 | | | | |– isobject@3.0.1
| | | | ±- get-value@2.0.6
| | | | ±- has-value@1.0.0
| | | | | ±- has-values@1.0.0
| | | | | | ±- is-number@3.0.0
| | | | | | | -- kind-of@3.2.2 | | | | | |– kind-of@4.0.0
| | | | | -- isobject@3.0.1 | | | | +-- isobject@3.0.1 | | | | +-- set-value@2.0.0 | | | | |– extend-shallow@2.0.1
| | | | ±- to-object-path@0.3.0
| | | | ±- union-value@1.0.0
| | | | | -- set-value@0.4.3 | | | | |– extend-shallow@2.0.1
| | | | -- unset-value@1.0.0 | | | | +-- has-value@0.3.1 | | | | | +-- has-values@0.1.4 | | | | |– isobject@2.1.0
| | | | -- isobject@3.0.1 | | | +-- class-utils@0.3.6 | | | | +-- arr-union@3.1.0 | | | | +-- define-property@0.2.5 | | | | +-- isobject@3.0.1 | | | |– static-extend@0.1.2
| | | | ±- define-property@0.2.5
| | | | -- object-copy@0.1.0 | | | | +-- copy-descriptor@0.1.1 | | | |– define-property@0.2.5
| | | ±- component-emitter@1.2.1
| | | ±- define-property@1.0.0
| | | | -- is-descriptor@1.0.2 | | | | +-- is-accessor-descriptor@1.0.0 | | | | +-- is-data-descriptor@1.0.0 | | | |– kind-of@6.0.2
| | | ±- isobject@3.0.1
| | | ±- mixin-deep@1.3.1
| | | | -- is-extendable@1.0.1 | | |– pascalcase@0.1.1
| | ±- debug@2.6.9
| | | -- ms@2.0.0 | | +-- define-property@0.2.5 | | |– is-descriptor@0.1.6
| | | ±- is-accessor-descriptor@0.1.6
| | | ±- is-data-descriptor@0.1.4
| | | -- kind-of@5.1.0 | | +-- extend-shallow@2.0.1 | | +-- source-map-resolve@0.5.2 | | | +-- atob@2.1.2 | | | +-- decode-uri-component@0.2.0 | | | +-- resolve-url@0.2.1 | | | +-- source-map-url@0.4.0 | | |– urix@0.1.0
| | -- use@3.1.1 |– to-regex@3.0.2
-- webpack-core@0.6.9 +-- source-list-map@0.1.8– source-map@0.4.4
`-- amdefine@1.0.1

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_moduleschokidar
ode_modulessevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“win32”,“arch”:“x64”})

执行 webpack -v 查看版本显示 4.20.2
ASUS@DESKTOP-AMFPHAD MINGW64 ~/mmall/doc/mmall-fe (mmall_v1.0)
$ webpack -v
4.20.2

也尝试再次安装 css-loader 与 style-loader,弹出同样问题
$ npm install css-loader style-loader --save-dev
mmall-fe@1.0.0 C:UsersASUSmmalldocmmall-fe
±- css-loader@1.0.0
| ±- babel-code-frame@6.26.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
| | ±- esutils@2.0.2
| | -- js-tokens@3.0.2 | +-- css-selector-tokenizer@0.7.0 | | +-- cssesc@0.1.0 | | +-- fastparse@1.1.1 | |– regexpu-core@1.0.0
| | ±- regenerate@1.4.0
| | ±- regjsgen@0.2.0
| | -- regjsparser@0.1.5 | |– jsesc@0.5.0
| ±- icss-utils@2.1.0
| ±- loader-utils@1.1.0
| ±- lodash.camelcase@4.3.0
| ±- postcss@6.0.23
| | ±- chalk@2.4.1
| | | -- ansi-styles@3.2.1 | | |– color-convert@1.9.3
| | | -- color-name@1.1.3 | | +-- source-map@0.6.1 | |– supports-color@5.5.0
| | -- has-flag@3.0.0 | +-- postcss-modules-extract-imports@1.2.0 | +-- postcss-modules-local-by-default@1.2.0 | +-- postcss-modules-scope@1.1.0 | +-- postcss-modules-values@1.3.0 | |– icss-replace-symbols@1.1.0
| ±- postcss-value-parser@3.3.0
| -- source-list-map@2.0.0 +-- style-loader@0.23.0 | +-- loader-utils@1.1.0 |– schema-utils@0.4.7
| ±- ajv@6.5.4
| | ±- fast-deep-equal@2.0.1
| | ±- fast-json-stable-stringify@2.0.0
| | ±- json-schema-traverse@0.4.1
| | -- uri-js@4.2.2 | |– punycode@2.1.1
| -- ajv-keywords@3.2.0– UNMET PEER DEPENDENCY webpack@1.15.0

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_moduleschokidar
ode_modulessevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“win32”,“arch”:“x64”})
npm WARN css-loader@1.0.0 requires a peer of webpack@^4.0.0 but none was installed.

webpack.config.js 文件配置信息
var webpack = require(‘webpack’); //引用 webpack.

var config = {
entry : {
‘common’ : [’./src/page/common/index.js’],
‘index’ : [’./src/page/index/index.js’],
‘login’ : [’./src/page/login/index.js’]
},
output : {
path : ‘./dist’,
filename : ‘js/[name].js’
},
externals : {
‘jquery’ : ‘window.jQuery’
},
module: {
loaders: [
{ test: /.css$/, loader: “style-loader!css-loader” }
]
},
plugins : [
new webpack.optimize.CommonsChunkPlugin({
name : ‘common’,
filename : ‘js/base.js’
})
]
};
module.exports = config;

麻烦老师帮看看是啥子原因重新下载了 webpack 还是不行路径似乎也没错咯。

正在回答

1回答

Rosen 2018-10-07 07:33:26

版本最好按着课程里的来,安装的时候都加着版本号。warn 可以先忽略,有error了再把错误贴出来

0 回复 有任何疑惑可以回复我~
  • 提问者 会飞的铁蛋 #1
    非常感谢!
    回复 有任何疑惑可以回复我~ 2018-10-13 18:10:01
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号