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

node: "package.json does not exist at " + package_json_path #259

Closed
ianks opened this issue Aug 12, 2016 · 25 comments
Closed

node: "package.json does not exist at " + package_json_path #259

ianks opened this issue Aug 12, 2016 · 25 comments

Comments

@ianks
Copy link

ianks commented Aug 12, 2016

When attempting to load the node version of the current master branch, I am met with this error:

/home/ianks/the-power/node_modules/indexeddbshim/dist/indexeddbshim-node.js:10774
        throw new Error("package.json does not exist at " + package_json_path);
              ^
Error: package.json does not exist at /package.json
    at Object.exports.find (/home/ianks/the-power/node_modules/indexeddbshim/dist/indexeddbshim-node.js:10774:15)
    at Object.<anonymous> (/home/ianks/the-power/node_modules/indexeddbshim/dist/indexeddbshim-node.js:7416:27)
    at Object.309../trace (/home/ianks/the-power/node_modules/indexeddbshim/dist/indexeddbshim-node.js:7602:4)
    at s (/home/ianks/the-power/node_modules/indexeddbshim/dist/indexeddbshim-node.js:1:630)
    at /home/ianks/the-power/node_modules/indexeddbshim/dist/indexeddbshim-node.js:1:681
    at Object.353../SQLiteResult (/home/ianks/the-power/node_modules/indexeddbshim/dist/indexeddbshim-node.js:16572:15)
    at s (/home/ianks/the-power/node_modules/indexeddbshim/dist/indexeddbshim-node.js:1:630)
    at /home/ianks/the-power/node_modules/indexeddbshim/dist/indexeddbshim-node.js:1:681
    at Object.352../custom (/home/ianks/the-power/node_modules/indexeddbshim/dist/indexeddbshim-node.js:16565:22)
    at s (/home/ianks/the-power/node_modules/indexeddbshim/dist/indexeddbshim-node.js:1:630)
    at /home/ianks/the-power/node_modules/indexeddbshim/dist/indexeddbshim-node.js:1:681
    at Object.371../cfg.js (/home/ianks/the-power/node_modules/indexeddbshim/dist/indexeddbshim-node.js:20817:15)
    at s (/home/ianks/the-power/node_modules/indexeddbshim/dist/indexeddbshim-node.js:1:630)
    at e (/home/ianks/the-power/node_modules/indexeddbshim/dist/indexeddbshim-node.js:1:801)
    at /home/ianks/the-power/node_modules/indexeddbshim/dist/indexeddbshim-node.js:1:819
    at a (/home/ianks/the-power/node_modules/indexeddbshim/dist/indexeddbshim-node.js:1:88)
    at Object.<anonymous> (/home/ianks/the-power/node_modules/indexeddbshim/dist/indexeddbshim-node.js:1:332)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at setupDom (/home/ianks/the-power/test/inject.js:69:3)
    at Object.<anonymous> (/home/ianks/the-power/test/inject.js:93:1)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at /home/ianks/.nvm/versions/node/v6.2.2/lib/node_modules/mocha/bin/_mocha:310:3
    at Array.forEach (native)
    at Object.<anonymous> (/home/ianks/.nvm/versions/node/v6.2.2/lib/node_modules/mocha/bin/_mocha:309:10)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.runMain (module.js:575:10)
    at run (node.js:348:7)
    at startup (node.js:140:9)
    at node.js:463:3

All I am doing is simply:

// test/inject.js
require('indexeddbshim');

Any way to help fix this? This library looks like it can help solve my frontend testing woes and would love to get it working! Thank you for the work you have done here.

  • Ian
@brettz9
Copy link
Collaborator

brettz9 commented Aug 13, 2016

How did you indicate the indexeddbshim dependency in your project root?

Have you tried requiring using the relative path?

@ianks
Copy link
Author

ianks commented Aug 15, 2016

@brettz9 I have tried requiring the full path, the relative path, as well as just the package name. I indicated the dependency by adding it to my devDependencies.

@brettz9
Copy link
Collaborator

brettz9 commented Aug 15, 2016

Did you do it like this?

"devDependencies": {
    "indexeddbshim": "https://github.com/axemclion/IndexedDBShim#master"
}

and then run npm install?

@ianks
Copy link
Author

ianks commented Aug 15, 2016

Yes I did

@brettz9
Copy link
Collaborator

brettz9 commented Aug 15, 2016

Sorry then, I don't know. All I know is that it is working in our internal tests, and I don't have time at the moment to investigate further. It would be appreciated if you could report back if you do find out.

@brettz9
Copy link
Collaborator

brettz9 commented Aug 15, 2016

Btw, while there are already a great many fixes and improvements in master, my idea was to wait until the W3C tests were all set up properly and passing before making a new release (in order to save ourselves from support questions I don't have time to answer). I thought of adding instead to another branch, but I really think any changes should be made on top of master.

@subvertallchris
Copy link

subvertallchris commented Sep 20, 2016

You have references to your local WAMP installation in indexeddbshim-node.js, it is looking for sqlite3 (which isn't included in package.json as a dependency) in there.

}).call(this,"/wamp\\www\\IndexedDBShim\\node_modules\\sqlite3\\lib")

If you install sqlite3 and fix the bad paths, this library can at least be required without crashing. I haven't made it far enough to say whether it actually works.

  • line 7604
}).call(this, path.join(__dirname, '../../sqlite3/lib'))
  • line 7650
// }).call(this,"/wamp\\www\\IndexedDBShim\\node_modules\\sqlite3\\lib\\trace.js")
}).call(this, path.join(__dirname, '../../sqlite3/lib/trace.js'))
  • line 10759
// }).call(this,"/wamp\\www\\IndexedDBShim\\node_modules\\sqlite3\\node_modules\\node-pre-gyp\\lib")
}).call(this, path.join(__dirname, '../../sqlite3/node_modules/node-pre-gyp/lib")

This seems to me like something that your CI environment could have caught. Is that something you could resolve when you have a moment? I'd also love if there was a stable version with node support in NPM. Cloning your repo adds over 100MB of unnecessary dependencies to a project's already-bloated node_modules dir.

@brettz9
Copy link
Collaborator

brettz9 commented Sep 20, 2016

Thank you very much for identifying the problem here, @subvertallchris !

I do have the websql devDependency which has sqlite3 as a dependency, but yeah, that should be changed and those paths you mention of course shouldn't be baked in like that (I know I didn't hard-code those paths myself). I will try to give some time to fixing this, as it looks like it shouldn't be too difficult to address, though I am battling limited time and health problems atm.

As far as a release... When I had been in a position to concentrate on this, my intent was to complete compliance with the W3C tests (or to at least fix the major issues) and then to focus on assuring we did some real world testing to ensure performance or what not had not become a problem in the process, as I did not want to introduce a number of (standard-compliant) breaking changes without being ready to assuage users that the change was worth it, nor to be distracted with reports of remaining issues I knew to be problems though which I could fix with a little bit more time.

FWIW, we have gotten pretty close now to passing the W3C and other tests as inherited from another project, but I found this project, besides needing an update, had made some shortcuts in adapting the tests which I wanted to avoid for more accurate compliance testing. I did start work on an in-place system for adapting these tests (which are written in HTML), so the HTML could be converted on-the-fly to Node-friendly JavaScript, allowing for both Node and potentially command-line browser testing and avoiding the need for maintenance headaches upon every W3C test upgrade.

However, while now working marginally, the new testing environment still is apparently not set up properly as an inexplicably large of a number of these new W3C tests are failing and I haven't had time to investigate and fix the new testing environment, much less to finish work on the handful of remaining known (significant) failures (as found in the old W3C tests), e.g., blocking events and, if possible, transactional rollbacks.

One tip re: cloning--you should be able to avoid cloning recursively, at least avoiding the very large W3C tests, but yes, of course, we need to get this to release.

@brettz9
Copy link
Collaborator

brettz9 commented Sep 24, 2016

@subvertallchris : I have a new version pushed to master which I believe fixes the reported issue. Please confirm.

Although I don't think we are ready for a new regular npm release yet for the reasons mentioned above, if you like, I can tag a separate branch to provide an insufficiently tested and incompletely bug-fixed version but one which is at least theoretically working for Node and non-changing. You should then be able to target the Github branch within your package.json until the stable version is ready.

@subvertallchris
Copy link

Thanks for the thorough writeup and followup! I'll give this a shot in
Monday and let you know how it looks.

On Friday, September 23, 2016, Brett Zamir notifications@github.com wrote:

@subvertallchris https://github.com/subvertallchris : I have a new
version pushed to master which I believe fixes the reported issue. Please
confirm.

Although I don't think we are ready for a new regular npm release yet for
the reasons mentioned above, if you like, I can tag a separate branch to
provide an insufficiently tested and incompletely bug-fixed version but one
which is at least theoretically working for Node and non-changing. You
should then be able to target the Github branch within your package.json
until the stable version is ready.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#259 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AD6E9xfhTnUv9-dy9Nw-mZoVb40V5I28ks5qtJzXgaJpZM4Jjggs
.

@brettz9
Copy link
Collaborator

brettz9 commented Oct 5, 2016

Find a chance to check it out, @subvertallchris ?

@subvertallchris
Copy link

Unfortunately no, not yet. Sorry for the delay. I had to double back to a different feature to meet a deadline. I'll be giving it another shot in the next week or two.

@brettz9
Copy link
Collaborator

brettz9 commented Oct 18, 2016

This should be fixed, but feel free to reopen if you still see issues.

FYI, the remaining to-dos I wish to handle before an npm release are described at #262 (comment) . I currently have some energy and time to work on these issues, so hopefully it won't be more than a few weeks, but no guarantees.

@brettz9 brettz9 closed this as completed Oct 18, 2016
@erikvold
Copy link
Contributor

I'm getting running into this error, which appears to be related to this issue:

/Users/user/abc/rise/node_modules/indexeddbshim/dist/indexeddbshim-node.js:8409
        throw new Error("package.json does not exist at " + package_json_path);
        ^

Error: package.json does not exist at /Users/user/abc/rise/node_modules/indexeddbshim/node_modules/sqlite3/package.json
    at Object.exports.find (/Users/user/abc/rise/node_modules/indexeddbshim/dist/indexeddbshim-node.js:8409:15)
...

@brettz9
Copy link
Collaborator

brettz9 commented Feb 12, 2017

Try deleting sqlite3 out of node_modules, running npm cache clean to be safe, and running install again. One time I had to do this after installing a new version of Node (though with a different error message), and another time I believe I got that same error, though I can't remember what the conditions were. But I'm almost certain that should do the trick.

@erikvold
Copy link
Contributor

erikvold commented Feb 12, 2017

Try deleting sqlite3 out of node_modules, running npm cache clean to be safe

@brettz9 that doesn't seem to make a difference.

I'm using node 7.5.0 and npm 4.1.2, and there appears to be a project/node_modules/sqlite3 folder but the error message appears to suggest that IndexedDBShim is looking for project/node_modules/indexeddbshim/node_modules/sqlite3 which does not exist.

@erikvold
Copy link
Contributor

If I cd project/node_modules/indexeddbshim && npm install then things seem to work, at least I get past the error above atm. This shouldn't be necessary though, I'll see if I can find a patch.

@brettz9
Copy link
Collaborator

brettz9 commented Feb 12, 2017

Great, thanks... I've been busy testing support from within the repo...

@brettz9 brettz9 reopened this Feb 12, 2017
@erikvold
Copy link
Contributor

@brettz9 I think #282 fixes the issue, I built a new dist file with the patch and replaced that in my project, then removed the project/node_modules/indexeddbshim/node_modules and things seem to work.

@jboulmal
Copy link

Like you @erikvold. I've done quick fix by adding in my package.json:

package.json :
.........................
"scripts": {
       "setup": "npm install && cd node_modules/indexeddbshim && npm install sqlite3"
  },

Therefore, I run from console npm run setup

@brettz9
Copy link
Collaborator

brettz9 commented Feb 22, 2017

Ok, happy to report that I expect this trouble really ought to be resolved. Besides the fix from @erikvold to avoid hard-coding the relative paths I had tried previously, there was also the need to exclude the websql/* files (and therefore websql's dependencies) from browserification, a process which led to file paths tied to the builder's file system being stored in our distribution files.

Being as I am currently on the other side of the Great Firewall, however, I am having problems confirming this as I am not currently able to install indexeddbshim itself into another directory and npm can be quirky when trying to use over here. Could someone else try a fresh directory with a simple package.json and add indexeddbshim as a dependency, pointing to master, e.g.:

  "dependencies": {
    "indexeddbshim": "https://github.com/axemclion/IndexedDBShim"
  },

....and seeing if a simple Node script works, e.g.,

var setGlobalVars = require('indexeddbshim');
setGlobalVars();

var dbOpenRequest = indexedDB.open('test12345');
dbOpenRequest.onupgradeneeded = function (e) {
    console.log('Database Opened successfully');
};

@brettz9
Copy link
Collaborator

brettz9 commented Feb 23, 2017

OTOH, it could just be an issue with npm loading of indexeddbshim which would also nice to have reported if that is the case.

@erikvold
Copy link
Contributor

erikvold commented Feb 23, 2017

@brettz9 Works for me!

var setGlobalVars = require('indexeddbshim');
setGlobalVars(global);

var dbOpenRequest = indexedDB.open('test12345');
dbOpenRequest.onupgradeneeded = function (e) {
    console.log('Database Opened successfully');
};

@brettz9
Copy link
Collaborator

brettz9 commented Feb 23, 2017

Great! Thanks very much for the testing and feedback, Erik. (And per your example, I realized we ought to default to global when the others aren't present, so I've got that lined up in a PR I'm working on with some other fixes).

Oh, and just to be clear, you got it working via npm or was it through Git cloning?

I'll close this issue then, but feel free to add comments if people find any issues.

@erikvold
Copy link
Contributor

erikvold commented Feb 23, 2017

Oh, and just to be clear, you got it working via npm or was it through Git cloning?

I used npm install with:

 "dependencies": {
    "indexeddbshim": "axemclion/IndexedDBShim#master"
  }

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

5 participants