简体   繁体   English

安装包时卡住。 npm 错误。 notarget 找不到与 sockjs-client@0.0.0-unreleasable 匹配的版本

[英]stuck while installing packages. npm ERR! notarget No matching version found for sockjs-client@0.0.0-unreleasable

npm WARN read-shrinkwrap This version of npm is compatible with 
lockfileVersion@1, but npm-shrinkwrap.json was generated for 
lockfileVersion@0. I'll try to do my best with it!
npm ERR! code ETARGET
npm ERR! notarget No matching version found for sockjs-client@0.0.0- 
unreleasable
npm ERR! notarget In most cases you or one of your dependencies are 
requesting 
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of 'shoe'
npm ERR! notarget

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/node/.npm/_logs/2018-08-27T12_19_24_084Z-debug.log

i got this Error While installing packages it dont let me install packages please Help.我在安装软件包时遇到此错误,它不让我安装软件包,请帮助。

Thanks in Advance提前致谢

try out below steps to resolve that error尝试以下步骤来解决该错误

step 1 - remove your node_modules folder第 1 步 - 删除您的 node_modules 文件夹

rm -rf node_modules

step 2 -第2步 -

npm cache clean npm 缓存清理

step 3 -第 3 步 -

sudo apt-get install build-essential sudo apt-get install build-essential

step 4 - remove your package-lock.json and install node modules again.第 4 步 - 删除您的 package-lock.json 并再次安装节点模块。

npm install npm 安装

(if there is EACCESS error comes then try with sudo command.) (如果出现 EACCESS 错误,请尝试使用 sudo 命令。)

One cause of “code ETARGET” “notarget No matching version found for express@4.17.1” (when running npm update ) is prefer-offline=true in npm configuration, which causes npm (specifically npm-registry-cache ) to never update its HTTP cache if an existing resource was fetched. “code ETARGET”“notarget No matching version found for express@4.17.1”(运行npm update时)的一个原因是 npm 配置中的prefer-offline=true ,这导致 npm(特别是npm-registry-cache )永远不会更新如果获取了现有资源,则它的 HTTP 缓存。 prefer-offline can be useful to speed up npm ci , but if you use it for npm update , then npm / pacote will cache package metadata requests aka packuments (eg GET https://registry.npmjs.org/express ) forever and will not be able to update to the newest version. prefer-offline可用于加速npm ci ,但如果您将它用于npm update ,则npm / pacote将永远缓存包元数据请求 aka packuments (例如 GET https://registry.npmjs.org/express )并将无法更新到最新版本。 So if you have any of prefer-offline=true , cache-min=9999 , offline=true set in the npm CLI flags, environment variables , or npmrc files ( /path/to/my/project/.npmrc , ~/.npmrc , etc.), then don't forget to remove them when performing npm update and npm install .因此, offline=true您在 npm CLI 标志、 环境变量prefer-offline=true文件cache-min=9999 /path/to/my/project/.npmrc ~/.npmrc等),然后在执行npm updatenpm install时不要忘记删除它们。

So the takeaways as far as I can tell are:据我所知,要点是:

  • If you use --prefer-offline when you run npm install , npm update , npm outdated etc., then occasionally remove --prefer-offline or npm cache clean .如果您在运行npm installnpm updatenpm outdated等时使用--prefer-offline ,则偶尔删除--prefer-offlinenpm cache clean
  • Use npm ci --prefer-offline instead of npm install --prefer-offline when doing continuous builds在进行持续构建时使用npm ci --prefer-offline而不是npm install --prefer-offline

I solved the issue by我解决了这个问题

  1. Delete node-modules folder删除节点模块文件夹
  2. Deleting the package-lock.json file删除package-lock.json文件
  3. Run npm install运行npm install
  4. Now Run npm start现在运行npm start

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM