slc loopback:relation throws error
When I run the loopback relation command I get an error after I enter the property name for the relation.
The error:
/usr/local/lib/node_modules/strongloop/node_modules/rx/dist/rx.js:77
throw e;
^
true
Here is a log of my terminal so you can see all the options I selected:
$ slc loopback:relation
(node:31096) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
? Select the model to create the relationship from: Sport
? Relation type: has one
? Choose a model to create a relationship with: PerformanceEvaluation
? Enter the property name for the relation: (performanceEvaluations)
/usr/local/lib/node_modules/strongloop/node_modules/rx/dist/rx.js:77
throw e;
^
true
Any hints? Thanks!
And selection the model to create the relationship from:
@JordanMajd are you using node6?
@JordanMajd this is my console log of latest version of generator-loopback:
I am using node5. 5 and I don't see your error,
(node:31096) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
this warning is suspected, find some related issue : https://github.com/sequelize/cli/issues/291 Can you try with node5 and see if the error still exists?
Hey @jannyHou ,
I am using Node 6. Good call. I will try out a 5.* and see how it goes.
Thanks.
I'm seeing this same (or very similar) issue on 4.4.3. I do not get the first error:
(node:31096) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
But I do get the last error:
/usr/local/lib/node_modules/strongloop/node_modules/rx/dist/rx.js:77 throw e; ^ true
@nateha1984 could you fork https://github.com/strongloop/loopback-sandbox and upload your code? I fail to reproduce it on my end...seems it's not as simple as you create a model in an app then just establish a relation. it might be caused by other config.
and please also include your generator-loopback, loopback version:) Thanks.
I've uploaded my changes to https://github.com/nateha1984/loopback-sandbox
I've been following the loopback-getting-started tutorial and run into the error on this page of the docs: https://docs.strongloop.com/display/public/LB/Define+model+relations
loopback version: 2.28.0 generator-loopback version: 1.20.6
@nateha1984 I git cloned your repo and followed tutorial on the doc page:
A coffee shop has many reviews
but it still works fine, did I miss anything or steps?
No, that's about it. I've tried running through another 3rd party tutorial as well and had the same issue.
I haven't had a chance to retest with another version of Node, but do you think system could be a factor?
I'm on:
- OS X, El Capitan Version 10.11.4
- node v6.0.0
- [email protected]
@JordanMajd mine is windows. I am testing on mac now, need sometime to setup lol.
I'm also on OSX, same version
@JordanMajd @nateha1984 thank you I reproduced that error on osx.
I am facing the same error on windows. Any help to resolve to this will be much appreciated. Thank you.
@Arveti good to know that it also happens on windows. could you post your system info(win7?8?10?) and strongloop & generator-loopback version? Thanks.
Let me know if there is anything I can do to hlep @jannyHou
@jannyHou It's windows 7. Npm version - 3.3.12, strongloop - 6.0.0, generator-loopback - 1.20.6
Hello I have the same problem
C:\Users\mrjordan\AppData\Roaming\npm\node_modules\strongloop\node_modules\rx\dist\rx.js:77 throw e; ^ true
The running environment is: Windows7, I upgraded to [email protected] and these are the rest of versions: { 'loopback-server': '1.0. npm: '3.8.9', ares: '1.10.1-DEV', http_parser: '2.5.2', icu: '56.1', modules: '46', node: '4.4.4', openssl: '1.0.2h', uv: '1.8.0', v8: '4.5.103.35', zlib: '1.2.8' }
Could somebody help me with this issue?.
Regards.
I label it as a major issue, we will take a look at it as soon as possible. As a workaround, anyone run into this bug please check our doc https://docs.strongloop.com/display/public/LB/Tutorial%3A+model+relations or example https://github.com/strongloop/loopback-example-relations to manually add relations. Thanks for understanding.
Same issue here
Linux RHEL7.2 Node v4.4.3 strongloop v6.0.0 (node v4.4.3) ├── [email protected] (fb756f2) ├── [email protected] (8a73f8b) ├── [email protected] (cc2e089) ├── [email protected] (62e539b) ├── [email protected] (6ab604c) ├── [email protected] (f46e58f) ├── [email protected] (55d9a35) ├─┬ [email protected] (254835a) │ └── [email protected] (ec2d95b) ├── [email protected] (c53788b) ├── [email protected] └── [email protected]
? Select the model to create the relationship from: Grupo ? Relation type: has many ? Choose a model to create a relationship with: Tag ? Enter the property name for the relation: (tags)
node-v4.4.3-linux-x64/lib/node_modules/strongloop/node_modules/generator-loopback/node_modules/yeoman-generator/node_modules/yeoman-environment/node_modules/inquirer/node_modules/rx/dist/rx.js:77 throw e; ^ true
It seems something is missing here node-v4.4.3-linux-x64/lib/node_modules/strongloop/node_modules/generator-loopback/lib/helpers.js:
exports.checkRelationName = function (modelDefinition, name, callback) {
modelDefinition.properties(function(err, list) {
if (err) callback(err);
var conflict = list.some(function(property) {
return property.name === name;
});
if (conflict) {
callback('Same property name already exists: ' + name);
} else {
callback(true);
}
});
conflict is always false and callback throws an error.