BUPT-HJM / vue-blog

A single-user blog built with vue2, koa2 and mongodb which supports Server-Side Rendering
https://imhjm.com
MIT License
598 stars 127 forks source link

npm run dev报错 #10

Closed exo-m closed 7 years ago

exo-m commented 7 years ago

{ app: { port: 8889, baseApi: '/api' }, mongodb: { url: 'mongodb://localhost:27017/vue-blog' }, jwt: { secret: 'me' }, mongodbSecret: { user: 'andy', pass: '123456' }, admin: { user: 'admin', pwd: '123456' } } C:\WorkSpace\Project\nodejs\vue-blog\node_modules\require-dir\index.js:97 if (!require.extensions.hasOwnProperty(ext)) { ^

TypeError: require.extensions.hasOwnProperty is not a function at requireDir (C:\WorkSpace\Project\nodejs\vue-blog\node_modules\require-dir\index.js:97:37) at importDir (C:\WorkSpace\Project\nodejs\vue-blog\node_modules\import-dir\index.js:31:17) at Object. (C:/WorkSpace/Project/nodejs/vue-blog/server/api/index.js:6:16) at Module._compile (module.js:624:30) at loader (C:\WorkSpace\Project\nodejs\vue-blog\node_modules\babel-register\lib\node.js:144:5) at Object.require.extensions.(anonymous function) [as .js] (C:\WorkSpace\Project\nodejs\vue-blog\node_modules\babel-register\lib\node.js:154:7) at Module.load (module.js:545:32) at tryModuleLoad (module.js:508:12) at Function.Module._load (module.js:500:3) at Module.require (module.js:568:17) at require (internal/module.js:11:18) at Object. (C:/WorkSpace/Project/nodejs/vue-blog/server/index.js:9:1) at Module._compile (module.js:624:30) at loader (C:\WorkSpace\Project\nodejs\vue-blog\node_modules\babel-register\lib\node.js:144:5) at Object.require.extensions.(anonymous function) [as .js] (C:\WorkSpace\Project\nodejs\vue-blog\node_modules\babel-register\lib\node.js:154:7) at Module.load (module.js:545:32) [nodemon] app crashed - waiting for file changes before starting...

BUPT-HJM commented 7 years ago

node版本是6+么 如果不是,提供下node/npm版本以及环境~

exo-m commented 7 years ago

node:8.5.0 npm:5.3.0

exo-m commented 7 years ago

win10系统

BUPT-HJM commented 7 years ago

由于require-dir这个包的问题 https://github.com/aseemk/requireDir/commit/7fca87ce9659e920675460a81f9e61f56e4c8fec

# 解决方式:更新下require-dir
npm i require-dir@latest

我后面会更新仓库lock解决下这个问题

exo-m commented 7 years ago

OK

BUPT-HJM commented 7 years ago

已更新,可以pull下来更新一下代码 commit:https://github.com/BUPT-HJM/vue-blog/commit/3e88f9ae093b7d8386d21891cade0dd60c0b2c39