question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Code Generation Not Working on Mac

See original GitHub issue

Error Message

Done!
fs.js:50
    throw new TypeError('"options" must be a string or an object, got ' +
    ^

TypeError: "options" must be a string or an object, got number instead.
    at getOptions (fs.js:50:11)
    at Object.fs.writeFile (fs.js:1184:13)
    at /Users/lalluanthoor/node_modules/swagger-node-codegen/dist/codegen.js:127:18
    at tryToString (fs.js:425:3)
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:412:12)

I went into the source and removed , 0 from all the lines with _fs2.default.writeFile(target_file, content, 0, 'utf8', function (err) {. After that the code is generated properly. But when I say make build it fails with error:

...
Building API...
[08:21:19] Using gulpfile ~/swagger/gulpfile.js
[08:21:19] Starting 'build'...

events.js:160
      throw er; // Unhandled 'error' event
      ^
TypeError: /Users/lalluanthoor/swagger/src/api/routes/author.js: Duplicate declaration "err_response"
  37 |       const err_response = { status: 401, message: 'unauthorized' };
  38 |       return res.status(401).send(err_response);
> 39 |       const err_response = { status: 404, message: 'author not found' };
     |             ^
  40 |       return res.status(404).send(err_response);
  41 |       const err_response = { status: 500, message: 'internal server error' };
  42 |       return res.status(500).send(err_response);
    at File.buildCodeFrameError (/Users/lalluanthoor/swagger/node_modules/babel-core/lib/transformation/file/index.js:427:15)
    at Scope.checkBlockScopedCollisions (/Users/lalluanthoor/swagger/node_modules/babel-traverse/lib/scope/index.js:398:27)
    at Scope.registerBinding (/Users/lalluanthoor/swagger/node_modules/babel-traverse/lib/scope/index.js:592:16)
    at Scope.registerDeclaration (/Users/lalluanthoor/swagger/node_modules/babel-traverse/lib/scope/index.js:496:14)
    at Object.BlockScoped (/Users/lalluanthoor/swagger/node_modules/babel-traverse/lib/scope/index.js:244:28)
    at Object.newFn (/Users/lalluanthoor/swagger/node_modules/babel-traverse/lib/visitors.js:318:17)
    at NodePath._call (/Users/lalluanthoor/swagger/node_modules/babel-traverse/lib/path/context.js:76:18)
    at NodePath.call (/Users/lalluanthoor/swagger/node_modules/babel-traverse/lib/path/context.js:44:14)
    at NodePath.visit (/Users/lalluanthoor/swagger/node_modules/babel-traverse/lib/path/context.js:105:12)
    at TraversalContext.visitQueue (/Users/lalluanthoor/swagger/node_modules/babel-traverse/lib/context.js:150:16)
make: *** [build] Error 1

Config

$ node --version
v7.0.0

$ npm --version
3.10.8

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ghostcommented, Jul 5, 2017

closing since PR is merged.

0reactions
fmvilascommented, Jul 5, 2017

For 2, should I change the generated code to rename variables?

Yes. That would be good enough.

Thanks for the PR!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Code Generation not working since update on MacOS
Since the last update when I use the command “dotnet aspnet-codegenerator identity” with or without the context the identity scaffolding isn't working and ......
Read more >
help!! can not generate code for intents in xcode13 beta
Please try installing Xcode 13 beta 2, and compiling one of our sample code projects. If that still fails, please file a bug...
Read more >
quick-code-generation is not working on Visual Studio for Mac ...
I am trying to develop an extension where you show a popup with some text fields. Depending on the input , the extension...
Read more >
How to Use Apple's Two-Factor Authenticator Code Generator
To manually access Apple's authenticator on macOS devices, open up System Preferences. Then, head to Passwords. Once inside the menu, scroll ...
Read more >
Code generation in Matlab Simulink for Mac OS. - MathWorks
I installed Xcode 6 in my mac already still i am not able to navigate or find code generation in Model Configuration Parameters...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found