search

Home  >  Q&A  >  body text

javascript - npm集成webpack构建错误

package.json

  "scripts": {
    "build:dev": "npm run webpack --config config/webpack.dev.js",
  },
  "devDependencies": {
    "webpack": "^1.13.3"
  },

错误日志

0 info it worked if it ends with ok
1 verbose cli [ 'D:\\nodejs\\node.exe',
1 verbose cli   'D:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'build:dev' ]
2 info using npm@3.9.3
3 info using node@v6.2.1
4 verbose run-script [ 'prebuild:dev', 'build:dev', 'postbuild:dev' ]
5 info lifecycle hotpot-admin@1.0.0~prebuild:dev: hotpot-admin@1.0.0
6 silly lifecycle hotpot-admin@1.0.0~prebuild:dev: no script for prebuild:dev, continuing
7 info lifecycle hotpot-admin@1.0.0~build:dev: hotpot-admin@1.0.0
8 verbose lifecycle hotpot-admin@1.0.0~build:dev: unsafe-perm in lifecycle true
9 verbose lifecycle hotpot-admin@1.0.0~build:dev: 
10 verbose lifecycle hotpot-admin@1.0.0~build:dev: CWD: D:\WORK\weghst\hotpot-admin
11 silly lifecycle hotpot-admin@1.0.0~build:dev: Args: [ '/d /s /c', 'npm run webpack --config config/webpack.dev.js' ]
12 silly lifecycle hotpot-admin@1.0.0~build:dev: Returned: code: 1  signal: null
13 info lifecycle hotpot-admin@1.0.0~build:dev: Failed to exec build:dev script
14 verbose stack Error: hotpot-admin@1.0.0 build:dev: `npm run webpack --config config/webpack.dev.js`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (D:\nodejs\node_modules\npm\lib\utils\lifecycle.js:245:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:191:7)
14 verbose stack     at ChildProcess.<anonymous> (D:\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:191:7)
14 verbose stack     at maybeClose (internal/child_process.js:852:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
15 verbose pkgid hotpot-admin@1.0.0
16 verbose cwd D:\WORK\weghst\hotpot-admin
17 error Windows_NT 6.1.7601
18 error argv "D:\\nodejs\\node.exe" "D:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build:dev"
19 error node v6.2.1
20 error npm  v3.9.3
21 error code ELIFECYCLE
22 error hotpot-admin@1.0.0 build:dev: `npm run webpack --config config/webpack.dev.js`
22 error Exit status 1
23 error Failed at the hotpot-admin@1.0.0 build:dev script 'npm run webpack --config config/webpack.dev.js'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the hotpot-admin package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     npm run webpack --config config/webpack.dev.js
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs hotpot-admin
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls hotpot-admin
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

npm install 之后的命令

问题

  1. node_modules/.bin目录中的命令是可以直接在package.json中配置使用的吗?

  2. 上面的日志错误是啥原因?有大神能帮忙解答一下吗?

  3. 是否有大神能愿意分享一点点关于node.js日志查看的技巧,上面的日志我实在是没看出啥原因。

  4. Make sure you have the latest version of node.js and npm installed. npm是不是经常喜欢提示这个信息?感觉就像是口头禅一样。

怪我咯怪我咯2790 days ago702

reply all(1)I'll reply

  • PHPz

    PHPz2017-04-11 09:50:24

    1. 是的,前提是配置正确

    2. 日志上看不出来什么错,看看你的 webpack 文件是不是有错误

    3. 我不是大神。。。。。讲真,不太指望 npm 的日志

    4. 被你发现了。。。。。 npm 最喜欢干的。。

    reply
    0
  • Cancelreply