Using require with v20.0.0 does not work, but using v17.1.0 does. We confirmed this on two separate machines and devs.
We created a simple js script that requires v20.0.0. We then just use node to execute that script.
javascript
var google = require('googleapis');
We then get the error message, Error: Cannot find module 'googleapis'.
Thanks!
Same issue here.
The problem is due to the googleapi.ts not being compiled to googleapi.js.
To fix this, the maintainer should include the compiled version in the package.
However, it seems to work when I compile it myself :
cd node_modules/googleapis
npm install -g typescript
tsc # or npm run build
# There will be error messages, though it works anyway.
Thank you, solved my problem, until it's officially fixed
If this project had a "prepare" value in its package.json's "scripts" section, then that command would be run by npm automatically before the project was published. This value would probably work well for this project, assuming that the mistake made here was that build hadn't been run prior to publishing:
"scripts": {
"prepare": "npm run clean && npm run build",
Thank you, @etnbrd - very helpful...
Pull request #770
@AgentME, I used the prepack scripts, instead of the prepare because prepare seemed to be executed on the client as well, on an npm install (but I might be wrong).
This was my mistake (don't publish packages while on vacation). I just published [email protected] which should include the built .js files.
@jmdobry @ofrobots what do you think of setting up a release branch, and then automating the release via Travis? That way the merge into release would kick off the publish, not a task run from a dev machine. Thoughts?
@etnbrd The prepare script only runs if you run "npm install" within the project's own directory. It does not get run when the project is installed from npm as a dependency. Prepare is often used for compilation steps like this, though either one would prevent the specific problem of a publish happening without a build first.
This appears to be resolved. Let us know if there are still any issues!
Most helpful comment
The problem is due to the
googleapi.tsnot being compiled togoogleapi.js.To fix this, the maintainer should include the compiled version in the package.
However, it seems to work when I compile it myself :