Comments (5)
working on a fix
from bun.
looks like it's not fully identical to npm behavior (i've to use \"
instead of just "
):
(this is fish)
from bun.
Not sure if the following issue is related:
❯ bat -p package.json
{
"name": "blank",
"version": "0.0.3",
"module": "src/index.js",
"scripts": {
"demo": "echo \"test\""
},
"devDependencies": {
"bun-types": "latest"
}
}
❯ npm run demo
> [email protected] demo
> echo "test"
test
❯ bun run demo
$ echo \"test\"
"test"
Basically npm does JSON parsing but bun doesn't seem to do it.
from bun.
Thanks for reproducing, @kidonng, confirmed it's still an issue as of 0.2.2
. We'll get it fixed.
from bun.
Confirming this is still an issue with 0.5.9
:
"scripts": {
"start": "bun run src/app.ts",
"add:article": "curl -X POST -H 'Content-Type: application/json' -d '{\"id\":1,\"title\":\"Test article\",\"body\":\"Test body\"}' http://localhost:4000/articles/"
}
Running this won’t work with Bun:
$ bun run add:article
$ curl -X POST -H 'Content-Type: application/json' -d '{\"id\":1,\"title\":\"Test article\",\"body\":\"Test body\"}' http://localhost:4000/articles/
{
"title": "Bad Request",
"status": 400,
"detail": "Unable to parse JSON: JSON Parse error: Unrecognized token '\\'"
}
But it does with npm:
$ npm run add:article
> @ add:article
> curl -X POST -H 'Content-Type: application/json' -d '{"id":1,"title":"Test article","body":"Test body"}' http://localhost:4000/articles/
The reason is clearly that Bun doesn’t parse JSON as stated above.
from bun.
Related Issues (20)
- Not helpful error message InvalidStateError: The object is in an invalid state. HOT 1
- simsimd node module fails bindings HOT 3
- Support different orders for CLI arguments HOT 2
- Canary: thread panic on upgrade HOT 1
- Support / EOL policy
- Bun Version Manger - BVM for windows & linux HOT 1
- Building/Serving an angular app ends up hanging HOT 3
- Typescript Language server not detecting bun environment varibale override
- issue with jsonwebtoken module HOT 2
- Creating tiny reusable buffers runs out of memory HOT 2
- `file.stat()` is undefined in bun `1.0.21` HOT 2
- PR #7666 - breaks packages like dotenv HOT 3
- TypeError with Crypto's `createPublicKey` fn HOT 9
- cannot migrate lockfile version 2 (npm v7) that has `socksv5` installed (breaks playwright repo)
- Bun build fails if a .ts file is in the project root
- Bun install is failing in vercel (Turbo Repo) HOT 27
- `Decompression error: ShortRead` when fetching HOT 9
- Implement a `junit` reporter for `bun test` HOT 1
- Failed to spawn script postinstall due to error os.linux.errno.generic.E.PERM
- Regression: CDK commands no longer working after bun 1.0.8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bun.