【问题标题】:npm install: react-scripts install failsnpm install:react-scripts 安装失败
【发布时间】:2019-11-17 19:14:34
【问题描述】:

我有以下(简化的)package.json 文件:

`{
  "name": "cotd",
  "version": "0.0.3",
  "private": true,
  "dependencies": {},
  "devDependencies": {
    "react-scripts": "3.2.0"
  },
  "scripts": {
    "dev": "react-scripts start",
    "start": "react-scripts start"
  },
  "browserslist": [
    ">0.2%",
    "not ie <= 11",
    "not op_mini all"
  ]
}`

当我尝试使用npm install 安装它时,它多次失败(首先是一些关于已弃用依赖项的警告,最后是几个 npm ERR! 代码(见下文)。 我尝试删除 node_modules 文件夹,尝试npm cache clear --force,但都没有帮助。 这是 npm install 的输出:

$ npm install
npm WARN deprecated fsevents@1.2.9: One of your dependencies needs to upgrade to fsevents v2: 1) Proper nodejs v10+ support 2) No more fetching binaries from AWS, smaller package size
npm WARN deprecated left-pad@1.3.0: use String.prototype.padStart()
npm WARN deprecated core-js@2.6.10: core-js@<3.0 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN ts-pnp@1.1.4 requires a peer of typescript@* but none is installed. You must install peer dependencies yourself.
npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code EBUSY
npm ERR! syscall rename
npm ERR! path D:\MyEverything\Dropbox\Learning\WesBos\react-for-beginners\catch-of-the-day\node_modules\async\package.json.541798468
npm ERR! dest D:\MyEverything\Dropbox\Learning\WesBos\react-for-beginners\catch-of-the-day\node_modules\async\package.json
npm ERR! errno -4082
npm ERR! EBUSY: resource busy or locked, rename 'D:\MyEverything\Dropbox\Learning\WesBos\react-for-beginners\catch-of-the-day\node_modules\async\package.json.541798468' -> 'D:\MyEverything\Dropbox\Learning\WesBos\react-for-beginners\catch-of-the-day\node_modules\async\package.json'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\andra\AppData\Roaming\npm-cache\_logs\2019-11-17T19_03_36_237Z-debug.log

操作系统:Win10 家庭版,64 位 节点:v13.1.0 npm: 6.12.1

任何想法我做错了什么?

谢谢!

【问题讨论】:

  • 基本上如果节点抛出锁定、重命名、删除错误,这意味着它试图重命名由于某种原因被操作系统锁定的资源。我在 .npmrc 文件中使用了缓存和前缀选项,它解决了我的许多节点重命名和删除问题。添加两个名为“前缀”和“缓存”的条目,它们的值应该是当前文件夹节点模块文件夹之外的有效文件夹路径。我的观点cache = "c:\\workspace\\temp\\npm-cache" prefix = "c:\\workspace\\npm"
  • 感谢您的提示,虽然它没有解决我的问题,但给了我一个想法,引导我找到解决方案...见下文...

标签: javascript reactjs npm-install react-scripts


【解决方案1】:

因此,Dropbox 同步似乎是罪魁祸首,它在npm install 期间锁定了 npm 不喜欢的某些东西。 我将文件夹从我的 Dropbox 文件夹中移到了外面,然后......惊喜,惊喜......就像魅​​力一样。

现在的任务是找到一种解决方案来选择性地排除同步子文件夹(dropbox 不支持类似 .gitignore 的解决方案),但这与 javascript 或 node 或 npm 无关......

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-02-04
    • 2012-12-07
    • 1970-01-01
    • 2018-06-06
    • 2020-10-31
    相关资源
    最近更新 更多