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

Inferred name/version error message should be more specific #390

Closed
nihakue opened this issue Jun 10, 2016 · 3 comments
Closed

Inferred name/version error message should be more specific #390

nihakue opened this issue Jun 10, 2016 · 3 comments

Comments

@nihakue
Copy link

nihakue commented Jun 10, 2016

When I run electron-packager . --all with the following directory structure:

.
├── assets
│   ├── clefs.png
│   ├── free_bar.png
│   └── note.png
├── dist
│   ├── Note.js
│   └── app.js
├── index.html
├── index.js
├── node_modules
├── npm-debug.log
├── package.json
└── src
    ├── css
    │   └── app.css
    └── js
        ├── Note.js
        └── app.js

I get the following error:

Unable to infer name or version. Please specify a name and version.
Cannot find module 'package.json' from '/Users/gabriel/Code'(Properties not found yet: dependencies.electron-prebuilt,devDependencies.electron-prebuilt)

What I'm confused about is the "cannot find module..." bit, because process.cwd() should return /Users/gabriel/Code/sight, but electron-packager is looking in the parent dir. Am I missing something completely obvious?

Here's my package.json

Which version of electron-packager are you using?

"electron-packager": "^7.0.3",

What CLI arguments are you passing? Alternatively, if you are using the API, what parameters are
you passing to the packager() function?

electron-packager . --all

but also

electron-packager . --platform mas --arch x64 or any others

What version of Electron are you building with?

v1.2.1

What is the host platform are you running electron-packager on?

OSX 10.11.5 x64

What target platform(s)/architecture(s) are you building for?

all/any

Is there a stack trace in the error message you're seeing?

no

Please provide either a failing testcase or detailed steps to reproduce your problem.

run electron-packager . --all on my machine. 📦

@malept malept added needs info Issue reporter needs to provide more information for maintainers to take action bug 🐛 documentation 📝 and removed needs info Issue reporter needs to provide more information for maintainers to take action labels Jun 10, 2016
@malept malept changed the title Searching the wrong directory for package.json Inferred name/version error message should be more specific Jun 10, 2016
@malept
Copy link
Member

malept commented Jun 10, 2016

You need to specify the Electron version, either in the command line (--version) or in package.json (usually found in devDependencies as electron-prebuilt). The error message should be clearer about that.

@nihakue
Copy link
Author

nihakue commented Jun 10, 2016

Ah, of course. Not sure if I skimmed the docs too quickly, there's info missing that should be there, or I should just be smarter, but adding electron-prebuilt to my dev dependencies solved the problem.

I guess the resolve dir being wrong is caused by node-resolve searching the pwd, not finding version in the package.json there, and then moving to parent and failing there (thus the dir sent to err.message is the parent dir)?

@malept
Copy link
Member

malept commented Jun 10, 2016

I guess the resolve dir being wrong is caused by node-resolve searching the pdw, not finding version in the package.json there, and then moving to parent and failing there (thus the dir sent to err.message is the parent dir)?

That is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants