Nw.js: Can't load extension from relative path.

Created on 3 Mar 2017  路  4Comments  路  Source: nwjs/nw.js

If we load extension from a relative path, nw.js will start with error "Failed to load extension from: . Manifest file is missing or unreadable". So we have to use absolute path and our users can only run our app from /Applications.

Our package.json:

"chromium-args": "--load-extension='/Applications/xxx.app/Contents/Resources/app.nw/assets/vue-devtools'"

Which doesn't work:

"chromium-args": "--load-extension='assets/vue-devtools'"

It is same to WeChat Devtools, they have to use absolute path too. If we start it outside /Applications, It will give the same error.

image

Mac OSX version: 10.11.6
NW.js version: 0.19.6

P3 bug triaged

Most helpful comment

Same problem here in 0.33.4

All 4 comments

I tired with the sample in http://docs.nwjs.io/en/v0.13.0-beta7/For%20Users/Debugging%20with%20DevTools/#using-devtools-extensions.
Result: nwjs seems to depend on the current path(pwd of Terminal) for --load-extension relative path.
For example:
in the reporter's case,
the absolute path: /Applications/xxx.app/Contents/Resources/app.nw/assets/vue-devtools, if set "chromium-args": "--load-extension='assets/vue-devtools'", the current path of Terminal must be in /Applications/xxx.app/Contents/Resources/app.nw/, the relative path in package.json will be ok. Other path will throw an error.

There must be a way to set the CWD of a cocoa app so the relative paths work. I know that process.cwd prints out the app.nw folder where all the relative paths are, so I thought that would be enough.
@rogerwang I see on Mar 23 you mentioned adding a flag to specify project root in manifest.json. I believe this would solve the issue. https://github.com/nwjs/nw.js/issues/4672#issuecomment-288901140

This is still a problem in nw 0.29.4. Is there any update on this?

Same problem here in 0.33.4

Was this page helpful?
0 / 5 - 0 ratings