Working on long term projects and keeping up with the technologies can be hard. It may happen that some of the technologies you’re using change their configuration setting and you don’t see their docs on time or you simply — forget. This happened to me while using the pro version of FontAwesome. Their license «authentication» has changed over time and that’s fine if your project is young, but it’s less obvious when working on long term project.
If you’re reading this article, then you might be taken here by search engine that crawled this error:
error Received invalid response from npm.
Enter fullscreen mode
Exit fullscreen mode
In my case, I got this error while trying to execute yarn info prop-types
, but it can be any package from your packages.json file.
During the problem, yarn install
doesn’t work so you may end up with the similar looking error:
yarn install v1.19.2
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
error An unexpected error occurred: "https://npm.example.com/prop-types/-/prop-types-15.7.2.tgz: Request failed "404 Not Found"".
info If you think this is a bug, please open a bug report with the information provided in "/Users/vkoudela/path-to/your-project/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Enter fullscreen mode
Exit fullscreen mode
When you encounter this or similar problem, many developers would say:
- Delete
node_modules
folder and then tryyarn install
- Delete
node_modules
,yarn.lock
and then try again - Run
yarn cache clean
and then try again
But, what if you already tried that and it didn’t help?
We, developers, when trying to fix something, we tend to run something and then we see what happens. We fix one problem, then another, until we fix all of them.
So, to be able to solve your problem, you have to know in which order yarn
is using *rc files.
- In your project root (folder where you have your packages.json), it looks for
.yarnrc
file - Then it looks for
.npmrc
- Then it tries to find those files globally, which is usually your user folder:
~/.yarnrc
- Then it tries the same thing with
~/.npmrc
While troubleshooting and «fixing» the problem, you have to be aware of the fact that even if yarn install
fails to execute properly, it would still create yarn.lock
file taking all the settings from all .npmrc
and .yarnrc
on all four locations on your file system. So, even if you change any of the *rc files on any location after first failed attempt, it’s not enough because settings are written in yarn.lock
and yarn will reuse them on next execution.
Therefore, don’t forget to delete yarn.lock
before every other attempt of yarn install
.
Do you want to request a feature or report a bug?
bug
What is the current behavior?
Yarn fails to install @xtuc/long
If the current behavior is a bug, please provide the steps to reproduce.
> yarn add @xtuc/long yarn add v1.10.1 [1/5] 🔍 Validating package.json... [2/5] 🔍 Resolving packages... error Couldn't find package "@xtuc/long@4.2.1" required by "@webassemblyjs/wast-parser@1.7.8" on the "npm" registry. info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command. Error: Couldn't find package "@xtuc/long@4.2.1" required by "@webassemblyjs/leb128@1.7.8" on the "npm" registry. at MessageError.ExtendableBuiltin (/usr/local/Cellar/yarn/1.10.1/libexec/lib/cli.js:243:66) at new MessageError (/usr/local/Cellar/yarn/1.10.1/libexec/lib/cli.js:272:123) at PackageRequest.<anonymous> (/usr/local/Cellar/yarn/1.10.1/libexec/lib/cli.js:33701:17) at Generator.throw (<anonymous>) at step (/usr/local/Cellar/yarn/1.10.1/libexec/lib/cli.js:98:30) at /usr/local/Cellar/yarn/1.10.1/libexec/lib/cli.js:111:13 at <anonymous> at process._tickCallback (internal/process/next_tick.js:189:7) Error: Couldn't find package "@xtuc/long@4.2.1" required by "@webassemblyjs/wast-printer@1.7.8" on the "npm" registry. at MessageError.ExtendableBuiltin (/usr/local/Cellar/yarn/1.10.1/libexec/lib/cli.js:243:66) at new MessageError (/usr/local/Cellar/yarn/1.10.1/libexec/lib/cli.js:272:123) at PackageRequest.<anonymous> (/usr/local/Cellar/yarn/1.10.1/libexec/lib/cli.js:33701:17) at Generator.throw (<anonymous>) at step (/usr/local/Cellar/yarn/1.10.1/libexec/lib/cli.js:98:30) at /usr/local/Cellar/yarn/1.10.1/libexec/lib/cli.js:111:13 at <anonymous> at process._tickCallback (internal/process/next_tick.js:189:7) Error: Couldn't find package "@xtuc/ieee754@^1.2.0" required by "@webassemblyjs/ieee754@1.7.8" on the "npm" registry. at MessageError.ExtendableBuiltin (/usr/local/Cellar/yarn/1.10.1/libexec/lib/cli.js:243:66) at new MessageError (/usr/local/Cellar/yarn/1.10.1/libexec/lib/cli.js:272:123) at PackageRequest.<anonymous> (/usr/local/Cellar/yarn/1.10.1/libexec/lib/cli.js:33701:17) at Generator.throw (<anonymous>) at step (/usr/local/Cellar/yarn/1.10.1/libexec/lib/cli.js:98:30) at /usr/local/Cellar/yarn/1.10.1/libexec/lib/cli.js:111:13 at <anonymous> at process._tickCallback (internal/process/next_tick.js:189:7) > yarn info @xtuc/long versions yarn info v1.10.1 error Received invalid response from npm. > npm info @xtuc/long versions npm http request GET https://registry.yarnpkg.com/@xtuc%2flong npm http 200 https://registry.yarnpkg.com/@xtuc%2flong [ '4.0.0', '4.1.0', '4.2.0', '4.2.1' ]
What is the expected behavior?
The package should get installed
Please mention your node.js, yarn and operating system version.
Node v8.12.0
Yarn v1.10.1
MacOS v10.12.6
When you install npm packages using npm install
command, sometimes there will be an npm error when parsing the JSON response from the registry.
An example of the error is as follows:
npm ERR! registry error parsing json
npm ERR! Darwin 20.6.0
npm ERR! node v4.9.1
npm ERR! npm v2.15.11
npm ERR! Unexpected token <
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /Users/nsebhastian/npm-debug.log
This error is caused by an invalid JSON response from the registry.
However, finding what causes npm to receive an invalid JSON response is a bit complicated to do.
Here are four things you can try to resolve the issue:
- Set registry to npmjs
- Clean npm cache and node modules
- Check your internet proxy
- Upgrade your npm to the latest LTS version
This tutorial will help you learn how to do the above fixes.
Set registry to npmjs
You need to make sure that your registry is pointed to https://registry.npmjs.org to try and fix this error.
You can check your registry by running the get registry
command as follows:
$ npm config get registry
https://npm.strongloop.com
As of this writing, any public alternatives to the official registry from npmjs.org have expired.
If you have any other entry than npmjs.org, then you need to change the registry using the set registry
command as follows:
npm config set registry https://registry.npmjs.org
After that, try running npm install
and see if it works now.
Clear node_modules folder and npm cache files
The first thing you can try to fix the error is to clear the project module dependencies. This includes the node_modules
folder and package-lock.json
file.
You can do this by running the following command from your project root directory:
rm -rf node_modules
rm package-lock.json
Once you clear the project module dependencies, clean your npm cache with the following command:
$ npm cache clean --force
Once done, run npm install
again and see if it works.
Check your internet proxy
You need to check your npm error output and see if there’s a line saying Authentication Required as shown below:
npm ERR! Authentication Required
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /Users/nsebhastian/npm-debug.log
The error highlighted above usually indicates that you are accessing the internet using a proxy. You need to authenticate npm so that it can access the internet using your proxy.
Set the proxy in the npm config with the following commands:
npm config set proxy 'username:password@your.proxy.com'
npm config set https-proxy 'username:password@your.proxy.com'
Keep in mind that this will expose your proxy username and password to anyone who can access your npm installation. The credentials are written in the .npmrc
file.
You can use Fiddler as a bridge between npm and your proxy to avoid writing your username and password in the config file.
You can see a guide here: Using Fiddler as proxy for npm
If you are using NTLM for the proxy, you can also use CNTLM to set up a localhost proxy that authenticates your npm install
command.
Here’s a guide to setting up CNTLM: CNTLM as proxy for npm
However you want to authenticate your npm install
internet access, please make sure that the proxy is the cause of the error.
You can always delete your proxy credentials with npm config delete
:
npm config delete proxy
npm config delete https-proxy
The above commands should remove your proxy credentials from the .npmrc
file.
Upgrade your npm to the latest LTS version
If you never upgrade your Node.js installation, then it’s possible that you have a very old version of npm installed on your computer.
It’s best to check your Node.js and npm version and make sure that you’re at least 2 versions down from the latest version.
As of this writing, here are the LTS versions available in Node:
lts/erbium -> v12.22.12
lts/fermium -> v14.19.2
lts/gallium -> v16.15.0
The latest version is lts/gallium
on v16.15.0
so you want to make sure that you’re at least using Node v12.22.12
. Node versions below lts/erbium
no longer receive support and bug fixes.
You can learn more about Node.js releases here.
Check your Node and npm versions by running the following commands from the terminal:
If you want to upgrade just npm, then you can follow this guide to use the latest stable version of npm.
A very old version of npm may not be able to download and install packages from the registry, so you need to upgrade it.
Conclusion
The npm registry error in parsing JSON occurs when an invalid JSON entry is given to npm.
While npm expects a valid JSON text, an HTML file can be given as a response to the npm install
command.
The four methods above should help you to resolve the issue, but if you still see the same error, you might want to post the detail of your error to StackOverflow so that others can help you resolve it.
Thanks for reading! I hope this tutorial has helped you 🙏
Hello, experts!
When I open my dev space I got this message and some important extensions are not acessible anymore like the hana-database-explorer or the deployment of hana artifacts functionality (a littlle rocket icon)
The problem happens also in a new dev space created right now.
Could anyone help on this?
The complete log details:
npm config set @sap-ux:registry https://common.repositories.cloud.sap/artifactory/api/npm/uxtools/ npm config set @devx-wing:registry https://common.repositories.cloud.sap/api/npm/devx-npm-live/ npm config set @sap-cds:registry https://common.repositories.cloud.sap/artifactory/api/npm/sap-cds/ npm config set @hana:registry https://common.repositories.sap.ondemand.com/artifactory/api/npm/build.releases.npm/ yarn global add --prefix /extbin/npm/globals --global-folder /extbin/npm/globals/lib @sap/generator-fiori@1.4.3 @sapui5/generator-sapui5-templates@1.71.* @sap/generator-cap-project@1.6.0 @sap/cds-dk@4.6.4 [1/4] Resolving packages... FW ERROR: The @devx-wing/vscode-java-dependency failed to install because Unable to calculate tarball URL for @devx-wing/vscode-java-dependency@0.22.0 npm package. yarn info stdout: stderr: {"type":"error","data":"Received invalid response from npm."} . FW ERROR: The @sap-cds/cds-editor failed to install because Unable to calculate tarball URL for @sap-cds/cds-editor@21.11.0 npm package. yarn info stdout: stderr: {"type":"error","data":"Received invalid response from npm."} . FW ERROR: The @sap-ux/sap-ux-annotation-modeler-extension failed to install because Unable to calculate tarball URL for @sap-ux/sap-ux-annotation-modeler-extension@0.0.4750 npm package. yarn info stdout: stderr: {"type":"error","data":"Received invalid response from npm."} . FW ERROR: The @devx-wing/vscode-spring-boot-tools failed to install because Unable to calculate tarball URL for @devx-wing/vscode-spring-boot-tools@0.22.0 npm package. yarn info stdout: stderr: {"type":"error","data":"Received invalid response from npm."} . FW ERROR: The @devx-wing/vscode-java-debug failed to install because Unable to calculate tarball URL for @devx-wing/vscode-java-debug@0.22.0 npm package. yarn info stdout: stderr: {"type":"error","data":"Received invalid response from npm."} . FW ERROR: The @sap-ux/sap-ux-help-extension failed to install because Unable to calculate tarball URL for @sap-ux/sap-ux-help-extension@0.0.4750 npm package. yarn info stdout: stderr: {"type":"error","data":"Received invalid response from npm."} . FW ERROR: The @hana/sap-hana-project-explorer failed to install because Unable to calculate tarball URL for @hana/sap-hana-project-explorer@1.0.0-20210526114013 npm package. yarn info stdout: stderr: {"type":"error","data":"Received invalid response from npm."} . FW ERROR: The @devx-wing/vscode-redhat-java failed to install because Unable to calculate tarball URL for @devx-wing/vscode-redhat-java@0.22.0 npm package. yarn info stdout: stderr: {"type":"error","data":"Received invalid response from npm."} . FW ERROR: The @devx-wing/vscode-java-test failed to install because Unable to calculate tarball URL for @devx-wing/vscode-java-test@0.22.0 npm package. yarn info stdout: stderr: {"type":"error","data":"Received invalid response from npm."} . FW ERROR: The @devx-wing/w5g-wing failed to install because Unable to calculate tarball URL for @devx-wing/w5g-wing@0.0.5-20200914133334 npm package. yarn info stdout: stderr: {"type":"error","data":"Received invalid response from npm."} . FW ERROR: The @sap-ux/sap-ux-service-modeler-extension failed to install because Unable to calculate tarball URL for @sap-ux/sap-ux-service-modeler-extension@0.0.4750 npm package. yarn info stdout: stderr: {"type":"error","data":"Received invalid response from npm."} . FW ERROR: The @devx-wing/vscode-java-run failed to install because Unable to calculate tarball URL for @devx-wing/vscode-java-run@0.22.0 npm package. yarn info stdout: stderr: {"type":"error","data":"Received invalid response from npm."} . FW ERROR: The @sap-ux/sap-ux-application-modeler-extension failed to install because Unable to calculate tarball URL for @sap-ux/sap-ux-application-modeler-extension@0.0.4750 npm package. yarn info stdout: stderr: {"type":"error","data":"Received invalid response from npm."} . error Couldn't find package "@sap-ux/fiori-freestyle-writer@0.10.6" required by "@sap/generator-fiori@1.4.3" on the "npm" registry. info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command. warning @sap/generator-fiori > @sap/cds > @sap-cloud-sdk/core > @sap/xsenv > debug@4.2.0: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797) warning @sap/generator-fiori > yeoman-generator > yeoman-environment > globby > fast-glob > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated warning @sap/generator-fiori > yeoman-generator > yeoman-environment > globby > fast-glob > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated RETRY - Failed to install the @sap/generator-fiori module during the first try. Trying to reinstall it separately. yarn global add --prefix /extbin/npm/globals --global-folder /extbin/npm/globals/lib @sap/generator-fiori@1.4.3 [1/4] Resolving packages... error Couldn't find package "@sap-ux/fiori-freestyle-writer@0.10.6" required by "@sap/generator-fiori@1.4.3" on the "npm" registry. info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command. warning @sap/generator-fiori > @sap/cds > @sap-cloud-sdk/core > @sap/xsenv > debug@4.2.0: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797) warning @sap/generator-fiori > yeoman-generator > mem-fs-editor > globby > fast-glob > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated warning @sap/generator-fiori > yeoman-generator > mem-fs-editor > globby > fast-glob > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated FW ERROR: Failed to install the @sap/generator-fiori@1.4.3 module. RETRY - Failed to install the @sapui5/generator-sapui5-templates module during the first try. Trying to reinstall it separately. yarn global add --prefix /extbin/npm/globals --global-folder /extbin/npm/globals/lib @sapui5/generator-sapui5-templates@1.71.* [1/4] Resolving packages... warning @sapui5/generator-sapui5-templates > @sap/consume-services > @sap/wing-service-explorer > request@2.88.0: request has been deprecated, see https://github.com/request/request/issues/3142 warning @sapui5/generator-sapui5-templates > @sap/consume-services > @sap/wing-service-explorer > request > har-validator@5.1.5: this library is no longer supported warning @sapui5/generator-sapui5-templates > @sap/consume-services > @sap/wing-service-explorer > request > uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. warning @sapui5/generator-sapui5-templates > yeoman-generator > mem-fs-editor > globby > fast-glob > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated warning @sapui5/generator-sapui5-templates > yeoman-generator > mem-fs-editor > globby > fast-glob > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated [2/4] Fetching packages... [3/4] Linking dependencies... warning "@sapui5/generator-sapui5-templates > @sap/consume-services > @sap/modules-exploration > ts-node@8.1.0" has unmet peer dependency "typescript@>=2.0". [4/4] Building fresh packages... warning "@sapui5/generator-sapui5-templates@1.71.6" has no binaries RETRY - Failed to install the @sap/generator-cap-project module during the first try. Trying to reinstall it separately. yarn global add --prefix /extbin/npm/globals --global-folder /extbin/npm/globals/lib @sap/generator-cap-project@1.6.0 [1/4] Resolving packages... [2/4] Fetching packages... [3/4] Linking dependencies... warning "@sapui5/generator-sapui5-templates > @sap/consume-services > @sap/modules-exploration > ts-node@8.1.0" has unmet peer dependency "typescript@>=2.0". [4/4] Building fresh packages... warning "@sap/generator-cap-project@1.6.0" has no binaries RETRY - Failed to install the @sap/cds-dk module during the first try. Trying to reinstall it separately. yarn global add --prefix /extbin/npm/globals --global-folder /extbin/npm/globals/lib @sap/cds-dk@4.6.4 [1/4] Resolving packages... warning @sap/cds-dk > sqlite3 > node-pre-gyp@0.11.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future warning @sap/cds-dk > sqlite3 > node-gyp > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 warning @sap/cds-dk > sqlite3 > node-gyp > tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap. warning @sap/cds-dk > @sap/cds > @sap-cloud-sdk/core > @sap/xsenv > debug@4.2.0: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797) warning @sap/cds-dk > sqlite3 > node-gyp > request > har-validator@5.1.5: this library is no longer supported [2/4] Fetching packages... [3/4] Linking dependencies... warning "@sapui5/generator-sapui5-templates > @sap/consume-services > @sap/modules-exploration > ts-node@8.1.0" has unmet peer dependency "typescript@>=2.0". [4/4] Building fresh packages... success Installed "@sap/cds-dk@4.6.4" with binaries: - cds - cds-ts npm install --prefix /extbin/npm/globals -g @sap/generator-add-hdb-module@1.3.0 @sap/generator-hdb-project@1.3.0 npm notice [SECURITY] lodash has the following vulnerability: 1 high. Go here for more details: https://www.npmjs.com/advisories?search=lodash&version=4.17.21 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info. + @sap/generator-hdb-project@1.3.0 + @sap/generator-add-hdb-module@1.3.0 added 419 packages from 89 contributors in 8.674s Installation summary of Yeoman generators, global npm packages, VS Code extensions, and CLIs: Installation summary of the "java-dev-tools/java-dev-tools" extension: The @devx-wing/vscode-java-dependency failed to install because Unable to calculate tarball URL for @devx-wing/vscode-java-dependency@0.22.0 npm package. yarn info stdout: stderr: {"type":"error","data":"Received invalid response from npm."} . The @devx-wing/vscode-spring-boot-tools failed to install because Unable to calculate tarball URL for @devx-wing/vscode-spring-boot-tools@0.22.0 npm package. yarn info stdout: stderr: {"type":"error","data":"Received invalid response from npm."} . The @devx-wing/vscode-java-debug failed to install because Unable to calculate tarball URL for @devx-wing/vscode-java-debug@0.22.0 npm package. yarn info stdout: stderr: {"type":"error","data":"Received invalid response from npm."} . The @devx-wing/vscode-redhat-java failed to install because Unable to calculate tarball URL for @devx-wing/vscode-redhat-java@0.22.0 npm package. yarn info stdout: stderr: {"type":"error","data":"Received invalid response from npm."} . The @devx-wing/vscode-java-test failed to install because Unable to calculate tarball URL for @devx-wing/vscode-java-test@0.22.0 npm package. yarn info stdout: stderr: {"type":"error","data":"Received invalid response from npm."} . The @devx-wing/vscode-java-run failed to install because Unable to calculate tarball URL for @devx-wing/vscode-java-run@0.22.0 npm package. yarn info stdout: stderr: {"type":"error","data":"Received invalid response from npm."} . Installation summary of the "ext-mckbj/cds-modeller" extension (created by "SAP(MOB-MDE-MBG)"): The @sap-cds/cds-editor failed to install because Unable to calculate tarball URL for @sap-cds/cds-editor@21.11.0 npm package. yarn info stdout: stderr: {"type":"error","data":"Received invalid response from npm."} . Installation summary of the "ext-sap-ux/sap-ux-all-extensions" extension (created by "SAP(CA-UX-IDE)"): The @sap-ux/sap-ux-annotation-modeler-extension failed to install because Unable to calculate tarball URL for @sap-ux/sap-ux-annotation-modeler-extension@0.0.4750 npm package. yarn info stdout: stderr: {"type":"error","data":"Received invalid response from npm."} . The @sap-ux/sap-ux-help-extension failed to install because Unable to calculate tarball URL for @sap-ux/sap-ux-help-extension@0.0.4750 npm package. yarn info stdout: stderr: {"type":"error","data":"Received invalid response from npm."} . The @sap-ux/sap-ux-service-modeler-extension failed to install because Unable to calculate tarball URL for @sap-ux/sap-ux-service-modeler-extension@0.0.4750 npm package. yarn info stdout: stderr: {"type":"error","data":"Received invalid response from npm."} . The @sap-ux/sap-ux-application-modeler-extension failed to install because Unable to calculate tarball URL for @sap-ux/sap-ux-application-modeler-extension@0.0.4750 npm package. yarn info stdout: stderr: {"type":"error","data":"Received invalid response from npm."} . The @sap/generator-fiori failed to install. Installation summary of the "ext-hana-tools/hana-calculation-view-editor-base" extension (created by "SAP(HAN-BAS-EDT-MOD)"): The @sap/webide-hdi-base-feature-vscode VS Code extension was installed successfully. Installation summary of the "ext-hana-tools/hana-tools" extension (created by "SAP(HAN-BAS)"): The @sap/hana-theme-vscode VS Code extension was installed successfully. The @sap/hrtt-core-vscode VS Code extension was installed successfully. The @sap/hana-sqlscript-lsp VS Code extension was installed successfully. The @sap/create-hana-database-artifact VS Code extension was installed successfully. The @sap/generator-add-hdb-module node module was installed successfully. The @sap/generator-hdb-project node module was installed successfully. Installation summary of the "ext-hana-tools/hana-runtime-tools" extension (created by "SAP(HAN-BAS)"): The @sap/hana-database-explorer VS Code extension was installed successfully. Installation summary of the "hana-explorer/hana-explorer" extension: The @hana/sap-hana-project-explorer failed to install because Unable to calculate tarball URL for @hana/sap-hana-project-explorer@1.0.0-20210526114013 npm package. yarn info stdout: stderr: {"type":"error","data":"Received invalid response from npm."} . Installation summary of the "w5g-wing/w5g-wing" extension: The @devx-wing/w5g-wing failed to install because Unable to calculate tarball URL for @devx-wing/w5g-wing@0.0.5-20200914133334 npm package. yarn info stdout: stderr: {"type":"error","data":"Received invalid response from npm."} . Installation summary of the "ext-cdstoolsbas/cds-bas-extension" extension (created by "SAP(HAN-WDE-EDT-CDS)"): The @sap/vscode-cds VS Code extension was installed successfully. The @sap/generator-cap-project node module was installed successfully. The @sap/cds-dk node module was installed successfully. Installation summary of the "ext-hana-tools/hana-calculation-view-editor" extension (created by "SAP(HAN-BAS-EDT-MOD)"): The @sap/webide-hdi-feature-vscode VS Code extension was installed successfully. Installation summary of the "ext-hana-tools/hana-performance-tools" extension (created by "SAP(HAN-BAS-SA)"): The @sap/hana-performance-tools VS Code extension was installed successfully. Installation summary of the "ui5-worklist-app/ui5-worklist-app" extension: The @sapui5/generator-sapui5-templates node module was installed successfully. Finished installing App Studio simple extensions components! Total install time: 65318 milliseconds
Regards
#npm #eslint
Вопрос:
У меня есть приложение для портфолио Гэтсби, и мне пришлось внести в него некоторые изменения. Затем клонировал его с github и должен был установить зависимости. Когда я запускаю npm install
, у меня есть журнал ошибок ниже:
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: eslint-plugin-flowtype@undefined
npm WARN node_modules/eslint-plugin-flowtype
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer eslint-plugin-flowtype@"3.x || 4.x" from eslint-config-react-app@5.2.1
npm WARN node_modules/eslint-config-react-app
npm WARN eslint-config-react-app@"^5.2.1" from gatsby@2.32.13
npm WARN node_modules/gatsby
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: eslint-plugin-react@undefined
npm WARN node_modules/eslint-plugin-react
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer eslint-plugin-react@"7.x" from eslint-config-react-app@5.2.1
npm WARN node_modules/eslint-config-react-app
npm WARN eslint-config-react-app@"^5.2.1" from gatsby@2.32.13
npm WARN node_modules/gatsby
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: eslint-plugin-react-hooks@undefined
npm WARN node_modules/eslint-plugin-react-hooks
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer eslint-plugin-react-hooks@"1.x || 2.x" from eslint-config-react-app@5.2.1
npm WARN node_modules/eslint-config-react-app
npm WARN eslint-config-react-app@"^5.2.1" from gatsby@2.32.13
npm WARN node_modules/gatsby
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: graphql@undefined
npm WARN node_modules/graphql
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer graphql@"^14.4.1" from express-graphql@0.9.0
npm WARN node_modules/express-graphql
npm WARN express-graphql@"^0.9.0" from gatsby@2.32.13
npm WARN node_modules/gatsby
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: graphql@undefined
npm WARN node_modules/gatsby-source-strapi/node_modules/graphql
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer graphql@"^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0" from express-graphql@0.6.12
npm WARN node_modules/gatsby-source-strapi/node_modules/express-graphql
npm WARN express-graphql@"^0.6.6" from gatsby@1.9.279
npm WARN node_modules/gatsby-source-strapi/node_modules/gatsby
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: graphql@undefined
npm WARN node_modules/gatsby-source-strapi/node_modules/gatsby/node_modules/graphql
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer graphql@"^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0-b || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0" from graphql-relay@0.5.5
npm WARN node_modules/gatsby-source-strapi/node_modules/gatsby/node_modules/graphql-relay
npm WARN graphql-relay@"^0.5.1" from gatsby@1.9.279
npm WARN node_modules/gatsby-source-strapi/node_modules/gatsby
npm ERR! code FETCH_ERROR
npm ERR! errno FETCH_ERROR
npm ERR! invalid json response body at https://registry.npmjs.org/axios reason: Unexpected end of JSON input
Я очистил кэш с помощью npm cache clean --force
и запустил npm install
снова, но у меня все еще та же ошибка….
npm ERR! code FETCH_ERROR
npm ERR! errno FETCH_ERROR
npm ERR! invalid json response body at https://registry.npmjs.org/axios reason: Unexpected end of JSON input
Любая помощь, как я могу решить эту проблему, была бы очень признательна.
файл package.json
{
"name": "gatsby-starter-hello-world",
"private": true,
"description": "A simplified bare-bones starter for Gatsby",
"version": "0.1.0",
"license": "MIT",
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
"format": "prettier --write "**/*.{js,jsx,json,md}"",
"start": "npm run develop",
"serve": "gatsby serve",
"clean": "gatsby clean",
"test": "echo "Write tests! -> https://gatsby.dev/unit-testing" amp;amp; exit 1"
},
"dependencies": {
"gatsby": "^2.21.0",
"gatsby-image": "^2.4.0",
"gatsby-plugin-react-helmet": "^3.3.1",
"gatsby-plugin-webfonts": "^1.1.3",
"gatsby-plugin-sharp": "^2.6.0",
"gatsby-plugin-sitemap": "^2.4.2",
"gatsby-source-filesystem": "^2.3.0",
"gatsby-source-strapi": "0.0.12",
"gatsby-transformer-sharp": "^2.5.0",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-helmet": "^6.0.0",
"react-icons": "^3.10.0",
"react-markdown": "^4.3.1"
},
"devDependencies": {
"prettier": "2.0.5"
},
"repository": {
"type": "git",
"url": "https://github.com/gatsbyjs/gatsby-starter-hello-world"
},
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
}
}
Комментарии:
1. добавьте свой пакет.json здесь
2. Я отредактирую исходный пост и добавлю
package.json
Ответ №1:
Это не проблема с вашей стороны. Это не проблема package.json
. В ERR
URL https://registry.npmjs.org/axios
-адресе (последняя строка сообщения об ошибке) дается неверный ответ JSON. Смотрите изображение ниже. Проверка JSON завершается неудачно. Они должны решить эту проблему.
Попробуй бежать
npm cache clean --force
npm cache verify
yarn
Или попробуйте удалить, а затем переустановить.
Редактировать:
Удалите node_modules
папку и lock
файл. Затем попробуйте запустить yarn
Если вы еще не yarn
установили, установите его с помощью
npm i -g yarn
Проверьте установку с помощью
yarn --version
Комментарии:
1.Я получаю это
npm cache clean --force
npm WARN using --force Recommended protections disabled.
при запуске Когда я запускаюnpm cache verify
, я получаю следующие результаты: ` Проверка кэша npm Проверка кэша и сжатие (~/.npm/_cacache) Проверено содержимое: 0 (0 байт) Записей индекса: 0 Завершено за 0,009 с «2. Он установлен сейчас?
3. он не устанавливался
4. Хорошо, никаких проблем. Найдите его здесь —
https://github.com/t-yanick/tazoh-portfolio
5. Одну минуту. Я просто бегу
yarn
с простоpackage.json
after installation and build the strapi admin does not start
Bug report
Bug description
after installation and build strapi exits run with exit 0
Steps to reproduce the behavior
- yarn create strapi-app my-project —quickstart
- wait instalation done
- cd my-project
- yarn develop
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Code snippets
If applicable, add code samples to help explain your problem.
System
- Node.js version: v14.17.6
- NPM version: 6.14.15
- Strapi version: 3.6.8
- Database: tests quick install
- Operating System: Linux Mint 20.1
Kernel: Linux 5.4.0-84-generic
Architecture: x86-64
Additional context
the strapi doesn’t work with either docker or npm, same error
instalacao_strapi.mp4
strapi_develop.mp4
docker
strapi_docker.mp4
docker-compose.yaml
version: '3'
services:
strapi:
image: strapi/strapi
environment:
DATABASE_CLIENT: postgres
DATABASE_NAME: strapi
DATABASE_HOST: postgres
DATABASE_PORT: 5432
DATABASE_USERNAME: strapi
DATABASE_PASSWORD: strapi
volumes:
- ./app:/srv/app
ports:
- '1337:1337'
depends_on:
- postgres
postgres:
image: postgres
environment:
POSTGRES_DB: strapi
POSTGRES_USER: strapi
POSTGRES_PASSWORD: strapi
volumes:
- ./data:/var/lib/postgresql/data
After update from 3.6.6 or 3.6.7 to 3.6.8 doesnt start, yarn install OK, yarn build —clean exit code 1, yarn develop start build same error exit code 1
Hi @rafaumeu, from the videos sent, this appears to be an issue with your environment and not Strapi per se. I have attempted to reproduce this on a fresh installation of Ubuntu 20.1 and the version of Node specified to no avail. Is there anymore information you’d like to share concerning this? Is this the first time you’ve run a Strapi project on this environment without any significant change to it?
This is a duplicate of: https://forum.strapi.io/t/strapi-dont-starts/11189
@rafaumeu can you try using bash and not zsh?
in your terminal use
/bin/bash
and try to use npx that way to create a fresh project. My best guess is your zsh config is blocking something.
i tried npx on a virtual machine with a fresh installation, but the error was the same.
Hi @rafaumeu, from the videos sent, this appears to be an issue with your environment and not Strapi per se. I have attempted to reproduce this on a fresh installation of Ubuntu 20.1 and the version of Node specified to no avail. Is there anymore information you’d like to share concerning this?
@kasonde if there is any relevant information of course to provide.
- Well the installation of node was done with nvm 0.38.
- The yarn strapi has error code 1 not specified:
yarn run v1.22.11
$ strapi
Usage: strapi [options] [command]
Options:
-v, --version Output the version number
-h, --help Display help for command
Commands:
version Output your version of Strapi
console Open the Strapi framework console
new [options] <directory> Create a new application
start Start your Strapi application
develop|dev [options] Start your Strapi application in development mode
generate:api [options] <id> [attributes...] Generate a basic API
generate:controller [options] <id> Generate a controller for an API
generate:model [options] <id> [attributes...] Generate a model for an API
generate:policy [options] <id> Generate a policy for an API
generate:service [options] <id> Generate a service for an API
generate:plugin [options] <id> Generate a basic plugin
generate:template <directory> Generate template from Strapi project
build [options] Builds the strapi admin app
install [plugins...] Install a Strapi plugin
uninstall [options] [plugins...] Uninstall a Strapi plugin
watch-admin [options] Starts the admin dev server
configuration:dump|config:dump [options] Dump configurations of your application
configuration:restore|config:restore [options] Restore configurations of your application
admin:reset-user-password|admin:reset-password [options] Reset an admin user's password
help [command] Display help for command
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
- I ran the yarn info command:
yarn info v1.22.11
error Received invalid response from npm.
Done in 1.12s.
- I tested this command:
node test/create-test-app.js
returned this error:
internal/modules/cjs/loader.js:892
throw err;
^
Error: Cannot find module '/home/rafaelejosi/reactavancado-api/test/create-test-app.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)
at Function.Module._load (internal/modules/cjs/loader.js:745:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
- yarn start:
yarn run v1.22.11
$ strapi start
Illegal instruction (core dumped)
error Command failed with exit code 132.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
- yarn develop —watch-admin
is this the unique way «to serve admin panel» with an ethernal loop
Is this the first time you’ve run a Strapi project on this environment without any significant change to it?
It’s been a few days since I’ve been trying to use the strapi for the first time, but without success.
node test/create-test-app.js
Where did you get this command?
It appears like you are downloading our monorepo and trying to run it as an application. This repo is the source code of all of our packages, you can’t just clone it and run it (that’s not what it’s designed for).
To run a strapi application to either need to use npx create-strapi-app@latest your-project
or yarn create strapi-app your-project
I’ve tested this just today about 9 times on different virtual machines all in different clouds and on my host and I cannot reproduce your issue at all. Please try to do the follow and record a video of it using loom or something.
- Open a terminal
- Type this:
/bin/bash
+ enter key (this will temporarily change your terminal to using bash instead of zsh) - Type this:
npx create-strapi-app@latest test-project --quickstart
+ enter key - Wait for it to start up the project
I have a strong feeling either your network is extremely slow or you have heavily modified your bash profile when you installed zsh and broke something as I’ve been using linux mint for about 6 years and Strapi about 4.5 years and I’ve never seen that issue you are hitting on my own systems or anyone elses.
node test/create-test-app.js
Where did you get this command?
Hi @derrickmehaffy A person in the node telegram group suggested this test claiming that I had seen it in the documentation, I did it to see if it returned an error or something that could help with the problem, even without understanding. After trying some procedures including this one, he suggested opening an issue after not being successful in trying to help me.
It appears like you are downloading our monorepo and trying to run it as an application. This repo is the source code of all of our packages, you can’t just clone it and run it (that’s not what it’s designed for).
To run a strapi application to either need to use
npx create-strapi-app@latest your-project
oryarn create strapi-app your-project
I’ve tested this just today about 9 times on different virtual machines all in different clouds and on my host and I cannot reproduce your issue at all. Please try to do the follow and record a video of it using loom or something.
- Open a terminal
- Type this:
/bin/bash
+ enter key (this will temporarily change your terminal to using bash instead of zsh)- Type this:
npx create-strapi-app@latest test-project --quickstart
+ enter key- Wait for it to start up the project
I have a strong feeling either your network is extremely slow or you have heavily modified your bash profile when you installed zsh and broke something as I’ve been using linux mint for about 6 years and Strapi about 4.5 years and I’ve never seen that issue you are hitting on my own systems or anyone elses.
Procedure performed follows the video of the attempt.
What kind of thing could break the console and cause this kind of problem? I can provide my zsh configs they are even in a gist.
strapi_test.mp4
The speed should be 500 mb, but anyway in Brazil things don’t work as they should.
The things I did when installing my mint are in this post installation script
I’m downloading the latest linux mint iso and am going to spool up a virtual machine to test your post-install script to see if that is the root cause.
What kind of thing could break the console and cause this kind of problem? I can provide my zsh configs they are even in a gist.
Honestly it could be a lot of things, I stopped using zsh years ago now because of a ton of strange errors that I didn’t feel like debugging.
Alright, spun up a fresh Linux Mint 20.2 and ran your postinstall script (after troubleshooting some problems) and still couldn’t reproduce the issue. There has to be something else going on here.
At this point, I’d recommend booting into a live linux CD (like Linux mint) and install nvm + node 14 and test in that live environment to see if you still hit the same issue.
Alright, spun up a fresh Linux Mint 20.2 and ran your postinstall script (after troubleshooting some problems)
what problem? contribute there to improve pass me on discord!
and still couldn’t reproduce the issue. There has to be something else going on here.
At this point, I’d recommend booting into a live linux CD (like Linux mint)
What is it you downloaded? I used Linux Mint 20.2 xfce Brazil C3SL. With bootable pendrive created via
terminal. I checked integrity
and install nvm + node 14 and test in that live environment to see if you still hit the same issue.
@derrickmehaffy procedure done. however it presents the same problem. But I tried to record with Kazam but it didn’t save the video in the videos directory. Running on live usb.
Honestly @rafaumeu I have no idea, I cannot under any environment reproduce what you are hitting.
@derrickmehaffy @gastonfl @kasonde @thomaspockrandt Today I decided to try the procedure on Windows 10 et voila it worked, I installed it on a virtual machine running on linux on the same computer where it doesn’t work. I need recommendations for testing to solve this problem.
@derrickmehaffy @gastonfl @kasonde @thomaspockrandt Today I decided to try the procedure on Windows 10 et voila it worked, I installed it on a virtual machine running on linux on the same computer where it doesn’t work. I need recommendations for testing to solve this problem.
Was that windows computer physically different? CPU? RAM?
It’s my config
AMD Athlon(tm) II X2 250 Processor
ASUSTeK Computer INC. M4N68T-M LE
4gb RAM
Linux Mint 20.1 (Ulyssa) xfce4
NVIDIA Corporation GK208B [GeForce GT 710] (rev a1) 4.6.0 NVIDIA 470.74
It’s my Windows 10 VM work correctly @derrickmehaffy
@rafaumeu I’m sorry but there is just nothing else we can offer you:
Multiple people (myself and others on the team) have tested various configurations of different operating systems and hardware and none of us can reproduce what you are seeing. There is no question this is an environment issue and not a bug within Strapi. I’m out of ideas and thus going to set this issue as closed.
I’m sorry we can’t be of more help.