feathersjs-ecosystem / feathers-hooks

Service method hooks for easy authorization and processing
MIT License
59 stars 29 forks source link

V1.7.1: Module not found: Error: Can't resolve 'feathers-hooks-common/lib/populate' in '/app/node_modules/feathers-hooks/lib' @ ./~/feathers-hooks/lib/hooks.js 13:16-61 #142

Closed denghuiquan closed 7 years ago

denghuiquan commented 7 years ago

Steps to reproduce

I don't know how to describe about it, but i wonder why them have the strange relation.

I built it with angular2 hot module style.

Module Loader: "webpack": "2.2.0", "webpack-dev-middleware": "^1.10.1", "webpack-dev-server": "2.2.0", "webpack-dll-bundles-plugin": "1.0.0-beta.5",

daffl commented 7 years ago

Can you share a repository to reproduce this error? feathers-hooks-common populate should not be used or imported on the client.

denghuiquan commented 7 years ago

So, sorry, i tried to reproduce, but it did not occur today, maybe some options wrong with my webpack config. i will close this issues, if i meet it again, i will reopen it. thank you, @daffl

bdschr commented 7 years ago

Getting this error as well:

These dependencies were not found:

* feathers-hooks-common/lib/populate in ./~/feathers-hooks/lib/hooks.js
* feathers-hooks-common/lib/bundled in ./~/feathers-hooks/lib/hooks.js

To install them, you can run: npm install --save feathers-hooks-common/lib/populate feathers-hooks-common/lib/bundled

ERROR in ./~/feathers-hooks/lib/hooks.js
Module not found: Error: Can't resolve 'feathers-hooks-common/lib/populate' in '/Users/david/Data/git/node/test/node_modules/feathers-hooks/lib'
 @ ./~/feathers-hooks/lib/hooks.js 13:16-61
 @ ./~/babel-loader/lib?{"presets":["vue-app"],"cacheDirectory":true}!./~/vue-loader/lib/selector.js?type=script&index=0!./pages/auth/login.vue
 @ ./pages/auth/login.vue
 @ ./.nuxt/router.js
 @ ./.nuxt/index.js
 @ ./.nuxt/client.js
 @ multi webpack-hot-middleware/client?reload=true ./.nuxt/client.js
ERROR in ./~/feathers-hooks/lib/hooks.js
Module not found: Error: Can't resolve 'feathers-hooks-common/lib/bundled' in '/Users/david/Data/git/node/test/node_modules/feathers-hooks/lib'
 @ ./~/feathers-hooks/lib/hooks.js 15:15-59
 @ ./~/babel-loader/lib?{"presets":["vue-app"],"cacheDirectory":true}!./~/vue-loader/lib/selector.js?type=script&index=0!./pages/auth/login.vue
 @ ./pages/auth/login.vue
 @ ./.nuxt/router.js
 @ ./.nuxt/index.js
 @ ./.nuxt/client.js
 @ multi webpack-hot-middleware/client?reload=true ./.nuxt/client.js
eddyystop commented 7 years ago

All hooks and utilities are now available off feathers-hooks-common directly.

On Thu, Apr 13, 2017 at 3:17 PM, bdschr notifications@github.com wrote:

Getting this error as well:

ERROR in ./~/feathers-hooks/lib/hooks.js Module not found: Error: Can't resolve 'feathers-hooks-common/lib/populate' in '/Users/david/Data/git/node/cabal/node_modules/feathers-hooks/lib' @ ./~/feathers-hooks/lib/hooks.js 13:16-61 @ ./~/babel-loader/lib?{"presets":["vue-app"],"cacheDirectory":true}!./~/vue-loader/lib/selector.js?type=script&index=0!./pages/auth/login.vue @ ./pages/auth/login.vue @ ./.nuxt/router.js @ ./.nuxt/index.js @ ./.nuxt/client.js @ multi webpack-hot-middleware/client?reload=true ./.nuxt/client.js ERROR in ./~/feathers-hooks/lib/hooks.js Module not found: Error: Can't resolve 'feathers-hooks-common/lib/bundled' in '/Users/david/Data/git/node/cabal/node_modules/feathers-hooks/lib' @ ./~/feathers-hooks/lib/hooks.js 15:15-59 @ ./~/babel-loader/lib?{"presets":["vue-app"],"cacheDirectory":true}!./~/vue-loader/lib/selector.js?type=script&index=0!./pages/auth/login.vue @ ./pages/auth/login.vue @ ./.nuxt/router.js @ ./.nuxt/index.js @ ./.nuxt/client.js @ multi webpack-hot-middleware/client?reload=true ./.nuxt/client.js

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/feathersjs/feathers-hooks/issues/142#issuecomment-293996387, or mute the thread https://github.com/notifications/unsubscribe-auth/ABezn1p4bQ3J0Wais_5rs5dHtWpsbl2Uks5rvnTRgaJpZM4MTXej .

bdschr commented 7 years ago

Thanks for the swift answer. Am new to feather.js and until now only used node for compiling es6 vue.js components to work with rest API's for frameworks in other languages. But can you elaborate exactly what's up with feathers-hooks-common? I tried to use the following vue.js (nuxt.js) component when I ended up with the error above.

<script>
import feathers from 'feathers/client'
import rest from 'feathers-rest/client'
import auth from 'feathers-authentication-client'
import hooks from 'feathers-hooks'
import axios from 'axios'
import localStorage from 'localstorage-memory'

const host = 'http://localhost:3030'
const app = feathers().configure(hooks())
            .configure(rest(host).axios(axios))
            .configure(auth({ storage: localStorage }))

const userService = app.service('users')

export default {
    layout: 'auth',
    data() {
         return {
            loginForm: {
                email: '',
                password: ''
            }
         }
    },
    methods: {
        login() {
            console.log(this.loginForm);
        }
    }
  }
</script>

When using feathers-hooks-common I get:

TypeError: __WEBPACK_IMPORTED_MODULE_3_feathers_hooks_common___default(...) is not a function
    at Object.exports.modules.Array.concat.Object.defineProperty.value (login.vue:28:0)
    at __webpack_require__ (webpack:/webpack/bootstrap 88ec5359c6ec0ae585f9:25:0)
    at Object.exports.modules.Array.concat.Object.defineProperty.value (pages/auth/login.vue:3:0)
    at __webpack_require__ (webpack:/webpack/bootstrap 88ec5359c6ec0ae585f9:25:0)

Many thanks!

eddyystop commented 7 years ago

What version of feathers hooks common are you using? The latest is 3.0.0. All hooks are available off require ('feathers-hooks-common') with no subfolders.

I don't see it being used in the example above.

eddyystop commented 7 years ago

THis is a duplicate of https://github.com/feathersjs/feathers-hooks/issues/149