-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Deno add - "Failed to install from package.json" "Unexpected character." #26653
Comments
Do you also have a |
I tried reproducing the problem and with provided |
@bartlomieju Sure what would you like to see? To answer your question, there is no package.json. $ ls -al
total 40
drwxr-xr-x@ 9 njenning staff 288 Oct 31 01:26 .
drwxr-xr-x@ 15 njenning staff 480 Aug 26 23:06 ..
-rw-r--r--@ 1 njenning staff 1077 Aug 26 23:06 LICENSE
-rw-r--r--@ 1 njenning staff 271 Aug 29 14:54 README.md
drwxr-xr-x@ 2 njenning staff 64 Oct 31 01:24 coverage
-rw-r--r--@ 1 njenning staff 823 Oct 31 01:26 deno.json
-rw-r--r--@ 1 njenning staff 5814 Aug 27 17:53 deno.lock
drwxr-xr-x@ 4 njenning staff 128 Aug 27 17:44 scripts
drwxr-xr-x@ 12 njenning staff 384 Oct 31 01:23 src
$ deno add npm:debug
Add npm:[email protected]
error: Failed to install from package.json
Caused by:
0: Invalid version requirement
1: Unexpected character.
^
~ It might be worth mentioning that this is a mono-repo, however I've never had issues converting packages one at a time with deno 1.45, it was only upgrading to 2.0.x that I started getting issues like this. |
@silverbucket is your reo public so o could try it myself? |
We should improve this error message to say the file the error occurs in. Probably there's a package.json in the workspace in this case. |
@bartlomieju Here's the repo + branch + package in the mono repo where I ran those commands: https://github.com/sockethub/sockethub/tree/migrate-to-deno/packages/schemas But while I was checking the modified files to commit and update that branch before I wrote this message, I noticed that the root package.json was modified with the debug dependencies. This goes along with what @dsherret was suggesting. So, for some reason, using
|
I opened #26665 which should help reduce the confusion slightly in the future. It will say the package.json file and the dependency that caused the issue.
@nathanwhit could you take a look? I don't think it should be doing that. |
Deno prefers to add |
Using deno project-root/packages/schemas $ deno install
error: Failed to install '@sockethub/client'
at file:///project-root/packages/examples/package.json
Caused by:
0: Invalid version requirement
1: Unexpected character.
^
~ |
@nathanwhit Should I create a new ticket? Or can you re-open this one? |
Hmm we're putting the dependency in the correct file now, but we error out because we validate all of the I feel like maybe we should make |
@nathanwhit we should just support it, see #26726 |
Hey, Im facing a similar issue when upgrading from v1.146 to v2. We have a backend monorepo and it uses # install
error: Error in @stripe/[email protected] parsing version requirement for dependency "react-dom": ">=16.8.0 && <=^19.0.0"
deno install
Caused by:
0: Invalid version requirement
1: Unexpected character.
>=16.8.0 && <=^19.0.0
~ # run
Running service
Watcher Process started.
error: Could not find a matching package for 'npm:[email protected]' in the node_modules directory. Ensure you have all your JSR and npm dependencies listed in your deno.json or package.json, then run `deno install`. Alternatively, turn on auto-install by specifying `"nodeModulesDir": "auto"` in your deno.json file.
Watcher Process started.
error: [ERR_MODULE_NOT_FOUND] Cannot find module 'file:///Users/app/node_modules/type-fest/index.js' imported from 'file:///Users/app/@types/date.types.ts'
at file:///Users/app/@types/date.types.ts:8:24 this is part of our import_map.json file: {
"imports": {
"kysely": "https://esm.sh/[email protected]",
"pg": "npm:[email protected]",
"query-string": "https://esm.sh/[email protected]?dts",
"remeda": "https://esm.sh/[email protected]?dts",
"stripe": "https://esm.sh/[email protected]?dts",
"type-fest": "npm:[email protected]",
"zod": "https://deno.land/x/[email protected]/mod.ts"
}
}
|
This doesn't work the way they probably think.
I opened https://github.com/stripe/react-stripe-js/pull/555/files A huge problem in npm dependencies is npm allows people to just put whatever even when it doesn't make sense. I'll update deno_semver to handle that situation. Follow denoland/deno_semver#41 for updates I think though the original issue can now be closed because workspace specifiers like |
Version: Deno 2.0.4
The text was updated successfully, but these errors were encountered: