直接webpack可以打包,使用npm run就报错,求解

来源:2-1 建立项目的 webpack 配置文件

榴莲痴汉

2017-03-30 12:48

报错内容:

Error: Cannot find module 'os-browserify/browser.script'

    at Function.Module._resolveFilename (module.js:469:15)

    at Function.resolve (internal/module.js:27:19)

    at Object.<anonymous> (D:\app\webpack_test02\node_modules\node-libs-browser\index.js:17:28)

    at Module._compile (module.js:570:32)

    at Object.Module._extensions..js (module.js:579:10)

    at Module.load (module.js:487:32)

    at tryModuleLoad (module.js:446:12)

    at Function.Module._load (module.js:438:3)

    at Module.require (module.js:497:17)

    at require (internal/module.js:20:19)

    at Object.<anonymous> (D:\app\webpack_test02\node_modules\webpack\lib\node\NodeSourcePlugin.js:7:23)

    at Module._compile (module.js:570:32)

    at Object.Module._extensions..js (module.js:579:10)

    at Module.load (module.js:487:32)

    at tryModuleLoad (module.js:446:12)

    at Function.Module._load (module.js:438:3)

    at Module.require (module.js:497:17)

    at require (internal/module.js:20:19)

    at WebpackOptionsApply.process (D:\app\webpack_test02\node_modules\webpack\lib\WebpackOptionsApply.js:71:25)

    at webpack (D:\app\webpack_test02\node_modules\webpack\lib\webpack.js:36:48)

    at processOptions (D:\app\webpack_test02\node_modules\webpack\bin\webpack.js:305:14)

    at Object.<anonymous> (D:\app\webpack_test02\node_modules\webpack\bin\webpack.js:363:1)

    at Module._compile (module.js:570:32)

    at Object.Module._extensions..js (module.js:579:10)

    at Module.load (module.js:487:32)

    at tryModuleLoad (module.js:446:12)

    at Function.Module._load (module.js:438:3)

    at Module.runMain (module.js:604:10)

    at run (bootstrap_node.js:394:7)

    at startup (bootstrap_node.js:149:9)


npm ERR! Windows_NT 10.0.10586

npm ERR! argv "C:\\node.js\\node.exe" "C:\\node.js\\node_modules\\npm\\bin\\npm-cli.js" "run" "webpack"

npm ERR! node v6.10.0

npm ERR! npm  v3.10.10

npm ERR! code ELIFECYCLE

npm ERR! webpack_test02@1.0.0 webpack: `webpack --config webpack.config.js --progress`

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the webpack_test02@1.0.0 webpack script 'webpack --config webpack.config.js --progress'.

npm ERR! Make sure you have the latest version of node.js and npm installed.

npm ERR! If you do, this is most likely a problem with the webpack_test02 package,

npm ERR! not with npm itself.

npm ERR! Tell the author that this fails on your system:

npm ERR!     webpack --config webpack.config.js --progress

npm ERR! You can get information on how to open an issue for this project with:

npm ERR!     npm bugs webpack_test02

npm ERR! Or if that isn't available, you can get their info via:

npm ERR!     npm owner ls webpack_test02

npm ERR! There is likely additional logging output above.


npm ERR! Please include the following file with any support request:

npm ERR!     D:\app\webpack_test02\npm-debug.log


写回答 关注

3回答

  • 苗苗苗
    2017-03-30 16:08:14
    已采纳

    有一些包没有装上

    榴莲痴汉

    一顿乱装,可算好了

    2017-03-30 16:13:27

    共 1 条回复 >

  • 鱼语与于余
    2018-05-10 17:14:54

    怎么解决呢?楼主

  • 妈咪妈咪哄
    2017-03-31 00:18:48

    肯定是当时网络不好,重新装一下webpack就行了

webpack深入与实战

webpack实战教程,用真实项目带你探索 webpack 强大的功能

86561 学习 · 721 问题

查看课程

相似问题