Could not resolve "../package.json" on v5.20.1
See original GitHub issueThanks for stopping by to let us know something could be better!
PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.
-
Is this a client library issue or a product issue? library issue
-
Did someone already solve this? Not that I can find
-
Do you have a support contract? No
Environment details
- OS: macOS
- Node.js version: 14 and 16
- npm version: 6.14.16 and 8.5.5
@google-cloud/storage
version: v5.20.1
Steps to reproduce
- Install
@google-cloud/storage
and use it as a dependency in your project - Package your project with esbuild
- See that it fails with the following errors:
✘ [ERROR] Could not resolve "../package.json"
node_modules/@google-cloud/storage/build/src/storage.js:384:34:
384 │ packageJson = require('../package.json');
╵ ~~~~~~~~~~~~~~~~~
✘ [ERROR] Could not resolve "../../package.json"
node_modules/@google-cloud/storage/build/src/nodejs-common/util.js:37:26:
37 │ packageJson = require('../../package.json');
╵ ~~~~~~~~~~~~~~~~~~~~
✘ [ERROR] Could not resolve "../package.json"
node_modules/@google-cloud/storage/build/src/gcs-resumable-upload.js:37:26:
37 │ packageJson = require('../package.json');
╵ ~~~~~~~~~~~~~~~~~
I am using firebase-admin
which has @google-cloud/storage
as a dependency. When I pin @google-cloud/storage
to 5.19.4
I can package my app fine with esbuild. When it is updated to v5.20.1
it starts to fail with the above error.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:12 (6 by maintainers)
Top Results From Across the Web
Could not resolve 'package.json' #15 - GitHub
The package.json file will be included in the bundle, but it is tree-shaken and inlined, so it should only include the "version" property...
Read more >npm WARN npm npm does not support Node.js v9.1.0
It turns out that the current installed npm is not compatible with the new node and has a hard time updating. The solution...
Read more >package.json - npm Docs
Trying to install another plugin with a conflicting requirement may cause an error if the tree cannot be resolved correctly. For this reason,...
Read more >Node.js - CloudBees Documentation
CodeShip uses nvm to manage different Node.js versions. ... If the version is not specified in package.json or if your project does not...
Read more >Preferred versions - Rush.js
But the common/temp/package.json described above would not guarantee this. ... ://developer.microsoft.com/json-schemas/rush/v5/common-versions.schema.json",
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
After investigating the issue was the result of a change we made to support running unit tests directly in TypeScript. This caused us to move to dynamic requires for
package.json
. This causedesbuild
to not be able to analyze / inline thepackage.json
any more. We have reverted the change and gone back to a single require call that should again allowesbuild
to inline the file. This will be released with5.20.4
. I am going to leave this issue open in the meantime.Thanks @timdp digging deeper into why this may be causing esbuild problems.