Industrial
Industrial•16mo ago

Error running Apollo example (on latest version)

Hi. When I run this example with the latest version of apollo from npm I get errors: https://deno.land/manual@v1.36.4/node/how_to_with_npm/apollo I tried removing the version to get the latest version and it pulled 4.9.3 which gave this error:
{"errors":[{"message":"Error loading package.json at /home/tom/Code/code9/node/test-fp-ls/node_modules/.deno/@apollo+utils.createhash@2.0.1/node_modules/sha.js/sha.js/package.json. Not a directory (os error 20)","extensions":{"code":"INTERNAL_SERVER_ERROR","stacktrace":["Error: Error loading package.json at /home/tom/Code/code9/node/test-fp-ls/node_modules/.deno/@apollo+utils.createhash@2.0.1/node_modules/sha.js/sha.js/package.json. Not a directory (os error 20)"," at resolveExports (internal:deno_node_loading/02_require.js:318:14)"," at Function.Module._findPath (internal:deno_node_loading/02_require.js:357:31)"," at Function.Module._resolveFilename (internal:deno_node_loading/02_require.js:618:27)"," at Function.Module._load (internal:deno_node_loading/02_require.js:467:27)"," at Module.require (internal:deno_node_loading/02_require.js:678:19)"," at require (internal:deno_node_loading/02_require.js:818:16)"," at createHash (file:///home/tom/Code/code9/node/test-fp-ls/node_modules/.deno/@apollo+utils.createhash@2.0.1/node_modules/@apollo/utils.createhash/dist/index.js:9:12)"," at Object.html (file:///home/tom/Code/code9/node/test-fp-ls/node_modules/.deno/@apollo+server@4.9.3/node_modules/@apollo/server/dist/esm/plugin/landingPage/default/index.js:67:29)"," at ApolloServer.executeHTTPGraphQLRequest (file:///home/tom/Code/code9/node/test-fp-ls/node_modules/.deno/@apollo+server@4.9.3/node_modules/@apollo/server/dist/esm/ApolloServer.js:480:77)"]}}]}
{"errors":[{"message":"Error loading package.json at /home/tom/Code/code9/node/test-fp-ls/node_modules/.deno/@apollo+utils.createhash@2.0.1/node_modules/sha.js/sha.js/package.json. Not a directory (os error 20)","extensions":{"code":"INTERNAL_SERVER_ERROR","stacktrace":["Error: Error loading package.json at /home/tom/Code/code9/node/test-fp-ls/node_modules/.deno/@apollo+utils.createhash@2.0.1/node_modules/sha.js/sha.js/package.json. Not a directory (os error 20)"," at resolveExports (internal:deno_node_loading/02_require.js:318:14)"," at Function.Module._findPath (internal:deno_node_loading/02_require.js:357:31)"," at Function.Module._resolveFilename (internal:deno_node_loading/02_require.js:618:27)"," at Function.Module._load (internal:deno_node_loading/02_require.js:467:27)"," at Module.require (internal:deno_node_loading/02_require.js:678:19)"," at require (internal:deno_node_loading/02_require.js:818:16)"," at createHash (file:///home/tom/Code/code9/node/test-fp-ls/node_modules/.deno/@apollo+utils.createhash@2.0.1/node_modules/@apollo/utils.createhash/dist/index.js:9:12)"," at Object.html (file:///home/tom/Code/code9/node/test-fp-ls/node_modules/.deno/@apollo+server@4.9.3/node_modules/@apollo/server/dist/esm/plugin/landingPage/default/index.js:67:29)"," at ApolloServer.executeHTTPGraphQLRequest (file:///home/tom/Code/code9/node/test-fp-ls/node_modules/.deno/@apollo+server@4.9.3/node_modules/@apollo/server/dist/esm/ApolloServer.js:480:77)"]}}]}
Deno
Apollo | Manual | Deno
Apollo Server is a GraphQL server that you can set up in minutes and use with your existing data source (or REST API). You can then connect any GraphQL client to it
2 Replies
Industrial
IndustrialOP•16mo ago
Actually, it's giving the same error with the example code/version
Deno AI Helper
Deno AI Helper•16mo ago
I'm sorry to hear that you're having trouble running the Apollo example. The error message you're seeing suggests that there's an issue with loading the package.json file for the sha.js module, which is a dependency of the @apollo/utils.createhash module. However, based on the documentation, Deno has native support for importing npm packages using npm: specifiers, and no node_modules folder is created when doing this. These packages are also subject to the same permissions as Deno applications. It's also worth noting that Deno has made several improvements to npm support, including handling npm specifiers in deno vendor and running pre and post scripts when executing a script from a package.json file. If you're still encountering issues, it might be helpful to check if there are any known issues with the specific versions of the Apollo and sha.js modules you're using. If you can't find a solution, you might want to consider reporting an issue at the denoland/deno repo. 🦕

Did you find this page helpful?