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

run populate command fails #4

Closed
idkjs opened this issue Jun 10, 2016 · 15 comments
Closed

run populate command fails #4

idkjs opened this issue Jun 10, 2016 · 15 comments

Comments

@idkjs
Copy link

idkjs commented Jun 10, 2016

Nice example effort. Thank you.

There is no node_modules/babel/ folder after npm install. Run populate is trying to reference it.
`Alains-MacBook-Pro-4:graphql-mongodb-example-master klik$ npm run populate

graphql-mongodb-example@0.0.1 populate /Users/klik/projects/graphql-mongodb-example-master
babel-node.js scripts/populationScript.es6

sh: babel-node.js: command not found

npm ERR! Darwin 15.5.0
npm ERR! argv "/Users/klik/.nvm/versions/node/v6.2.1/bin/node" "/Users/klik/.nvm/versions/node/v6.2.1/bin/npm" "run" "populate"
npm ERR! node v6.2.1
npm ERR! npm v3.9.3
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! graphql-mongodb-example@0.0.1 populate: babel-node.js scripts/populationScript.es6
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the graphql-mongodb-example@0.0.1 populate script 'babel-node.js scripts/populationScript.es6'.
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 graphql-mongodb-example package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! babel-node.js scripts/populationScript.es6
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs graphql-mongodb-example
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls graphql-mongodb-example
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/klik/projects/graphql-mongodb-example-master/npm-debug.log
Alains-MacBook-Pro-4:graphql-mongodb-example-master klik$`

@sayden
Copy link
Owner

sayden commented Jun 22, 2016

Sorry for the delay, I have tried few installation in few Linux distribution and it works perfectly. Maybe it's a Mac issue.

npm install
[...]
babel-relay-plugin@0.1.3 node_modules/babel-relay-plugin
├── graphql@0.4.18 (babel-runtime@5.8.38)
└── babel-core@5.8.38 (to-fast-properties@1.0.2, shebang-regex@1.0.0, trim-right@1.0.1, try-resolve@1.0.1, slash@1.0.0, path-exists@1.0.0, path-is-absolute@1.0.0, fs-readdir-recursive@0.1.2, babel-plugin-remove-console@1.0.1, babel-plugin-remove-debugger@1.0.1, babel-plugin-eval@1.0.1, babel-plugin-inline-environment-variables@1.0.1, babel-plugin-jscript@1.0.4, babel-plugin-property-literals@1.0.1, babel-plugin-member-expression-literals@1.0.1, babel-plugin-react-constant-elements@1.0.3, babel-plugin-undefined-to-void@1.1.6, babel-plugin-react-display-name@1.0.3, babel-plugin-constant-folding@1.0.1, babel-plugin-proto-to-assign@1.0.4, babel-plugin-dead-code-elimination@1.0.2, babel-plugin-runtime@1.0.7, globals@6.4.1, private@0.1.6, home-or-tmp@1.0.0, babel-plugin-undeclared-variables-check@1.0.2, esutils@2.0.2, convert-source-map@1.2.0, repeating@1.1.3, debug@2.2.0, js-tokens@1.0.1, is-integer@1.0.6, chalk@1.1.3, detect-indent@3.0.1, minimatch@2.0.10, output-file-sync@1.1.2, babylon@5.8.38, resolve@1.1.7, bluebird@2.10.2, source-map-support@0.2.10, json5@0.4.0, source-map@0.5.6, regenerator@0.8.40, lodash@3.10.1, regexpu@1.3.0, core-js@1.2.6)
 mcastro@mariocastro  /tmp/graphql-mongodb-example   master  npm run populate

> graphql-mongodb-example@0.0.1 populate /tmp/graphql-mongodb-example
> node_modules/babel/bin/babel-node.js scripts/populationScript.es6

576a71e48d3152984f31d8a3
 mcastro@mariocastro  /tmp/graphql-mongodb-example   master  npm start

> graphql-mongodb-example@0.0.1 start /tmp/graphql-mongodb-example
> node_modules/babel/bin/babel-node.js server.es6

Server listening at 9000

@ghost
Copy link

ghost commented Jun 29, 2016

@sayden What did you do to fix this? I'm having the same issue.

@sayden
Copy link
Owner

sayden commented Jul 2, 2016

@Sburke0708 actually I mentioned that I don't have this issue, maybe it's because I'm not using a Mac computer and I don't have any to try

@Jaikant
Copy link

Jaikant commented Jul 17, 2016

It worked seamlessly for me on a mac.

@pmahmud
Copy link

pmahmud commented Nov 1, 2016

@AArmanD After running npm install, try running the following:
To populate:
> node .\node_modules\babel\bin\babel-node.js .\scripts\populationScript.es6
To run the server:
> node .\node_modules\babel\bin\babel-node.js .\server.es6

@idkjs
Copy link
Author

idkjs commented Nov 4, 2016

@pmahmud Thanks. Started over. ran npm install. Then tried your populate script. Output below. I tried re-running with your read me instruction, got same error. So looks like its not being read, maybe? Tried to see if the .es6 extension is being read in babel-node but could not confirm. I am thinking that is it.

klik:graphql-mongodb-example klik$ node .\node_modules\babel\bin\babel-node.js .\scripts\populationScript.es6
module.js:442
    throw err;
    ^

Error: Cannot find module '/Users/klik/Projects/graphql-mongodb-example/.node_modulesbabelbinbabel-node.js'
    at Function.Module._resolveFilename (module.js:440:15)
    at Function.Module._load (module.js:388:25)
    at Function.Module.runMain (module.js:575:10)
    at startup (node.js:160:18)
    at node.js:456:3
klik:graphql-mongodb-example klik$ node ./node_modules/babel/bin/babel-node.js ./scripts/populationScript.es6
/Users/klik/Projects/graphql-mongodb-example/node_modules/babel-core/lib/transformation/file/options/option-manager.js:126
      if (!option) this.log.error("Unknown option: " + alias + "." + key, ReferenceError);
                           ^

TypeError: Cannot read property 'error' of undefined
    at OptionManager.mergeOptions (/Users/klik/Projects/graphql-mongodb-example/node_modules/babel-core/lib/transformation/file/options/option-manager.js:126:28)
    at OptionManager.addConfig (/Users/klik/Projects/graphql-mongodb-example/node_modules/babel-core/lib/transformation/file/options/option-manager.js:107:10)
    at OptionManager.findConfigs (/Users/klik/Projects/graphql-mongodb-example/node_modules/babel-core/lib/transformation/file/options/option-manager.js:168:35)
    at OptionManager.init (/Users/klik/Projects/graphql-mongodb-example/node_modules/babel-core/lib/transformation/file/options/option-manager.js:229:12)
    at compile (/Users/klik/Projects/graphql-mongodb-example/node_modules/babel-core/lib/api/register/node.js:117:22)
    at normalLoader (/Users/klik/Projects/graphql-mongodb-example/node_modules/babel-core/lib/api/register/node.js:199:14)
    at Object.require.extensions.(anonymous function) [as .es6] (/Users/klik/Projects/graphql-mongodb-example/node_modules/babel-core/lib/api/register/node.js:216:7)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)

@pmahmud
Copy link

pmahmud commented Nov 4, 2016

@AArmanD , it seems you are using unix, in that case try replacing the backslashes with slash like this:
> node ./node_modules/babel/bin/babel-node.js ./scripts/populationScript.es6
This assumes that you are in the graphql-mongodb-example folder and already ran npm install command and have babel-node.js inside the path: 'node_modules/babel/bin/'.
If you look closely at the error line:
Error: Cannot find module '/Users/klik/Projects/graphql-mongodb-example/.node_modulesbabelbinbabel-node.js'
This is not a valid path and I assume backslashes are the problem here:
/.node_modulesbabelbinbabel-node.js

@idkjs
Copy link
Author

idkjs commented Nov 5, 2016

using mac, el capitan. If you look above \ failed so switched to / and it ran but gave the errors we are discussing.

@pmahmud
Copy link

pmahmud commented Nov 7, 2016

@AArmanD There are other ways to solve this, but here is a naive one:
copy populationScript.es6 from scripts folder and paste inside node_modules/babel/bin/ folder and cd into it and then run:
> node ./babel-node.js ./populationScript.es6

@idkjs
Copy link
Author

idkjs commented Nov 8, 2016

@pmahmud that didnt work. This is totally to figure out what is possibly causing this issue that no one else has so dont feel pressed. Im thinking that since your project doesnt have a .babelrc file in it, the options manager is erroring out when it doesnt find it. I know there are other ways to do set babelrc options so maybe this should not affect it. Definite side project to learn something to run this down.

@idkjs
Copy link
Author

idkjs commented Nov 8, 2016

@pmahmud maybe has something to do with this. CrabDude/babel-node-debug#7. Lots has happened with babel since you build this.

@pmahmud
Copy link

pmahmud commented Nov 8, 2016

@AArmanD, @sayden is the author. I am guessing that is not related. Your error log says it cannot find babel-node at your machine. Meaning maybe the path is wrong or it was not installed properly. It's a bit weird error I would say, but you could try installing babel globally and/or separately:

  • npm install babel-cli -g
  • npm install --save-dev babel-cli
  • Also see here

@idkjs idkjs closed this as completed Nov 17, 2016
@sudheerj
Copy link

I also got the same issue while running on windows machine.None of the solutions worked out.Any help is appreciated.

@sayden
Copy link
Owner

sayden commented Dec 17, 2016

@sudheerj In the case of Windows is probably a problem of paths. Scripts that you can find in package.json are *nix like paths that use "/" for the tree.

Windows uses "" (backslashes) so those script must be rewritten to work in Windows machines.

I'm sorry but I don't have any windows platform on hand right now

@sayden sayden reopened this Dec 17, 2016
@sudheerj
Copy link

Thanks Sayden.I installed babel plugins globally and changed the script paths as below.It worked fine after that.
"scripts": {
"start": "babel-node server.es6",
"populate": "babel-node scripts/populationScript.es6"
}

@idkjs idkjs closed this as completed Jan 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants