0
回答
学习webpack时使用npm run 命令出错,直接webpack就可以打包
利用AWS快速构建适用于生产的无服务器应用程序,免费试用12个月>>>   
{
  "name": "webpack_test02",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error : no test specified\"&& exit 1",
    "webpack": "webpack "
  },

配置里就是这么写的,在命令行直接使用webpack就可以顺利打包,使用npm run webpack提示错误,如下

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 `
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the webpack_test02@1.0.0 webpack script 'webpack '.
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
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

<无标签>
举报
榴莲痴汉
发帖于9个月前 0回/477阅
顶部