node.jsgithubnpmgraphqlgraphql-tag

What the /src means when installing npm package?


I try to build (again) a React project that worked very well before the client calls me and tells me that it has crashed.

When building (npm run build) I just get this :

Creating an optimized production build...
Failed to compile.

./src/utils/graphql.js
Cannot find module: 'graphql-tag/src'. Make sure this package is installed.

You can install this package by running: npm install graphql-tag/src.

However when I run the command given npm install graphql-tag/src it just keeps timeout attempting to ssh into what seems to be the github repo. I just CAN'T GET why it try to use SSH knowing that when I look in the packages.json file I can just find an http URL to an github repo for this specific package.

I tried to install the package classically npm install graphql-tag which works very well BUT when I relaunch the build I get the same failure.

I even tried to install the package directly with the URL of its github repo (https://github.com/apollographql/graphql-tag | found with a google search) but it just end up the same way.

I also tried to delete the folder node_modules and reinstall all npm i.

Finally this is what I get when I use the suggested command npm install graphql-tag/src when I look into the log file with cat /home/plagiat/.npm/_logs/2021-10-25T00_40_42_148Z-debug.log

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'install', 'graphql-tag/src' ]
2 info using npm@6.14.11
3 info using node@v12.21.0
4 verbose npm-session a25edec68e8c749c
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 silly pacote Retrying git command: ls-remote -h -t git://github.com/graphql-tag/src.git attempt # 2
8 silly pacote Retrying git command: ls-remote -h -t git://github.com/graphql-tag/src.git attempt # 3
9 silly pacote Retrying git command: ls-remote -h -t ssh://git@github.com/graphql-tag/src.git attempt # 2
10 silly pacote Retrying git command: ls-remote -h -t ssh://git@github.com/graphql-tag/src.git attempt # 3
11 silly fetchPackageMetaData error for github:graphql-tag/src Error while executing:
11 silly fetchPackageMetaData /usr/bin/git ls-remote -h -t ssh://git@github.com/graphql-tag/src.git
11 silly fetchPackageMetaData
11 silly fetchPackageMetaData ssh: connect to host github.com port 22: Connection timed out
11 silly fetchPackageMetaData fatal: Could not read from remote repository.
11 silly fetchPackageMetaData
11 silly fetchPackageMetaData Please make sure you have the correct access rights
11 silly fetchPackageMetaData and the repository exists.
11 silly fetchPackageMetaData
11 silly fetchPackageMetaData exited with error code: 128
12 timing stage:rollbackFailedOptional Completed in 0ms
13 timing stage:runTopLevelLifecycles Completed in 53964ms
14 verbose stack Error: exited with error code: 128
14 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/pacote/lib/util/finished.js:12:19)
14 verbose stack     at ChildProcess.emit (events.js:314:20)
14 verbose stack     at maybeClose (internal/child_process.js:1022:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
15 verbose cwd /home/plagiat/AntiPlagiat/client
16 verbose Linux 5.4.0-73-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" "graphql-tag/src"
18 verbose node v12.21.0
19 verbose npm  v6.14.11
20 error Error while executing:
20 error /usr/bin/git ls-remote -h -t ssh://git@github.com/graphql-tag/src.git
20 error
20 error ssh: connect to host github.com port 22: Connection timed out
20 error fatal: Could not read from remote repository.
20 error
20 error Please make sure you have the correct access rights
20 error and the repository exists.
20 error
20 error exited with error code: 128
21 verbose exit [ 1, true ]

Any insight would be appreciate.


Solution

  • In your case, the src/ folder would, when used with npm install, trigger the installation of its own package.json content (as in here), if present.

    However, if SSH URL is not reachable, you should switch to HTTPS.

    git config --global url.https://github.com/.insteadOf git://github.com/