Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_adminOnRest.fetchUtils is undefined #14

Closed
greg0ire opened this issue Sep 6, 2016 · 14 comments
Closed

_adminOnRest.fetchUtils is undefined #14

greg0ire opened this issue Sep 6, 2016 · 14 comments
Assignees
Labels

Comments

@greg0ire
Copy link
Contributor

greg0ire commented Sep 6, 2016

I'm trying to define my own rest client, and for the moment, just copy / pasted the contents of the tutorial inside an src/restClient.js file (I assumed the .js was missing in the tutorial), and tried to import it like this :

import restClient from './restClient'

I don't know how to import unnamed default functions, maybe this is wrong?

Anyway, I got the following stack trace :

Stack Trace

17:59:04,075 TypeError: _adminOnRest.fetchUtils is undefined
exports.default():115
App():24
ReactCompositeComponentMixin._constructComponentWithoutOwner():310
ReactCompositeComponentMixin._constructComponent():278
ReactCompositeComponentMixin.mountComponent():190
ReactReconciler.mountComponent():47
ReactCompositeComponentMixin.performInitialMount():385
ReactCompositeComponentMixin.mountComponent():260
ReactReconciler.mountComponent():47
mountComponentIntoNode():105
Mixin.perform():138
batchedMountComponentIntoNode():127
Mixin.perform():138
ReactDefaultBatchingStrategy.batchedUpdates():63
batchedUpdates():98
ReactMount._renderNewRootComponent():321
ReactMount._renderSubtreeIntoContainer():402
ReactMount.render():423
<anonyme>:19
<anonyme>bundle.js:1327
__webpack_require__()bundle.js:556
hotCreateRequire/fn()bundle.js:87
<anonyme>:4
<anonyme>bundle.js:589
__webpack_require__()bundle.js:556
<anonyme>bundle.js:579
<anonyme>bundle.js:1
1bundle.js%20line%208313%20%3E%20eval:115:9

Can you stop any obvious mistake here? I'm using v0.2.0.

@Kmaschta
Copy link
Contributor

Kmaschta commented Sep 6, 2016

What version of node do you use?

@greg0ire
Copy link
Contributor Author

greg0ire commented Sep 6, 2016

I use the version that comes with my distribution, I hope it matches the requirements:

node --version
v4.2.6

@Kmaschta
Copy link
Contributor

Kmaschta commented Sep 6, 2016

I recommend you to test with a higher version of node, like 5 or 6.
I'll try to reproduce the issue.

@greg0ire
Copy link
Contributor Author

greg0ire commented Sep 6, 2016

Thanks, I'll try that tomorrow!

@fzaninotto fzaninotto added the bug label Sep 6, 2016
@fzaninotto
Copy link
Member

There is a bug in the fetchUtils export in the lib. I'll try and fix that.

fzaninotto added a commit that referenced this issue Sep 6, 2016
@fzaninotto fzaninotto self-assigned this Sep 6, 2016
@djhi djhi closed this as completed in #17 Sep 6, 2016
@greg0ire
Copy link
Contributor Author

greg0ire commented Sep 7, 2016

Thanks for fixing this so quickly!

Noob question: how can I try it out? It looks like you can't just specify master as a version constraint for npm, so do I need to rm -rf the module, use git to get the master version, and then run npm install inside the freshly cloned repo? Or is there a simpler way? Or maybe you could just create a new release?

I recommend you to test with a higher version of node, like 5 or 6.

@Kmaschta : I tried it with node v5 and v6 and get the exact same error.

so do I need to rm -rf the module, use git to get the master version, and then run npm install inside the freshly cloned repo?

This strategy does not seem to work out for obscure reasons, so… I'm kind of stuck.

@fzaninotto
Copy link
Member

You can use npm ls... @jpetitcolas can you remind me how it works?

@jpetitcolas
Copy link
Contributor

Sure.

First, clone the repo admin-on-rest repo locally, and then use a symbolic link on your side project:

cd admin-on-rest
npm link

cd ../my-project
npm link admin-on-rest

Second time I write it today => I open a PR to add this dev tip in the README.

@greg0ire
Copy link
Contributor Author

greg0ire commented Sep 7, 2016

Huh… so the first npm link fails for the same obscure reasons :

Stack trace

sudo npm link
npm WARN optional dep failed, continuing fsevents@1.0.14
npm WARN deprecated to-iso-string@0.0.2: to-iso-string has been deprecated, use @segment/to-iso-string instead.
npm WARN deprecated jade@0.26.3: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN optional dep failed, continuing fsevents@1.0.14
npm ERR! peerinvalid The package react does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer material-ui@0.15.4 wants react@^15.0.0
npm ERR! peerinvalid Peer react-dom@15.3.0 wants react@^15.3.0
npm ERR! peerinvalid Peer react-redux@4.4.5 wants react@^0.14.0 || ^15.0.0-0
npm ERR! peerinvalid Peer react-router@2.5.2 wants react@^0.14.0 || ^15.0.0
npm ERR! peerinvalid Peer react-tap-event-plugin@1.0.0 wants react@^15.0.0-0
npm ERR! peerinvalid Peer enzyme@2.4.1 wants react@0.13.x || 0.14.x || ^15.0.0-0
npm ERR! peerinvalid Peer react-addons-test-utils@15.3.0 wants react@^15.3.0

npm ERR! System Linux 4.4.0-36-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "link"
npm ERR! cwd /home/users/gparis/dev/admin-on-rest
npm ERR! node -v v4.2.6
npm ERR! npm -v 1.4.15
npm ERR! code EPEERINVALID
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/users/gparis/dev/admin-on-rest/npm-debug.log
npm ERR! not ok code 0

I'm using sudo b/c npm link tries to write to /usr/lib/node_modules/admin-on-rest, not sure if this is normal or if there is something wrong with my setup.

@jpetitcolas
Copy link
Contributor

Documentation proposal submitted: marmelab/admin-on-rest#19

@jpetitcolas
Copy link
Contributor

I think this is a setup issue. As you sudo the link, npm perhaps ignore your local project dependencies (including React and so on). Not an expert of it. How did you install npm?

@greg0ire
Copy link
Contributor Author

greg0ire commented Sep 7, 2016

How did you install npm?

I don't remember, but I'll dig into that then. It looks like I installed it with my package manager, then removed it and installed it some other way :

dpkg -l |grep npm
rc  npm                                                         1.1.4~dfsg-2                                                all          package manager for Node.js

UPDATE: Ok so my version of npm was incredibly outdated… (v1.4.15 , and I have v3.10.7 now)

@greg0ire
Copy link
Contributor Author

greg0ire commented Sep 7, 2016

I followed @jpetitcolas ' guide and managed to run both link commands without errors, the results looks fine:

ls -l node_modules/admin-on-rest
lrwxrwxrwx 1 gparis gparis 52 sept.  7 11:44 node_modules/admin-on-rest -> ../../../../../../usr/lib/node_modules/admin-on-rest
ls -l node_modules/admin-on-rest/
total 44
-rw-r--r--  1 gparis gparis  379 sept.  6 17:48 CHANGELOG.md
drwxr-xr-x  2 gparis gparis 4096 sept.  7 11:10 docs
drwxr-xr-x  2 gparis gparis 4096 sept.  7 11:10 example
-rw-r--r--  1 gparis gparis 1105 sept.  6 17:48 LICENSE.md
-rw-r--r--  1 gparis gparis  325 sept.  6 17:48 Makefile
drwxr-xr-x 37 gparis gparis 4096 sept.  7 11:38 node_modules
-rw-r--r--  1 gparis gparis 1718 sept.  6 17:49 package.json
-rw-r--r--  1 gparis gparis 5162 sept.  6 17:48 README.md
drwxr-xr-x  8 gparis gparis 4096 sept.  7 11:10 src
-rw-r--r--  1 gparis gparis  258 sept.  6 17:48 webpack.config.js

The npm start output, not so :

Error in ./src/posts.js
Module not found: Error: Cannot resolve module 'admin-on-rest/lib/mui' in /home/users/gparis/workspace/dashboard-ui/src
 @ ./src/posts.js 12:11-43

Error in ./src/App.js
Module not found: Error: Cannot resolve module 'admin-on-rest' in /home/users/gparis/workspace/dashboard-ui/src
 @ ./src/App.js 11:19-43

I noticed that there is no lib directory in admin-on-rest, but maybe this should resolve to something else, like node_modules/admin-on-rest/node_modules/material-ui/, which does exist. Maybe I need to run another command? Also what about the requirement in the package.json manifest? Should I remove it? Leave it as is?

@greg0ire
Copy link
Contributor Author

greg0ire commented Sep 7, 2016

Ok so after some digging it appears that I need to run make build in admin-on-rest to make that work, see #20

fzaninotto pushed a commit that referenced this issue Oct 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants