标签: yarnpkg

为什么yarn create react-app命令不起作用

所以我尝试用yarn创建一个react项目,这样我就可以使用Elastic UI,但不幸的是我的终端在使用命令后出现错误

\n
yarn create react-app my-app\n
Run Code Online (Sandbox Code Playgroud)\n

错误

\n
\xe2\x9e\xa4 YN0000: \xe2\x94\x8c Resolution step\n\xe2\x9e\xa4 YN0061: \xe2\x94\x82 tar@npm:2.2.2 is deprecated: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.\n\xe2\x9e\xa4 YN0000: \xe2\x94\x94 Completed in 5s 215ms\n\xe2\x9e\xa4 YN0000: \xe2\x94\x8c Fetch step\n\xe2\x9e\xa4 YN0000: \xe2\x94\x94 Completed\n\xe2\x9e\xa4 YN0000: \xe2\x94\x8c Link step\n\xe2\x9e\xa4 YN0000: \xe2\x94\x94 Completed\n\xe2\x9e\xa4 YN0000: Done with warnings in 5s 507ms\n\n\nCreating a new React app in /home/flovet-stack/Documents/my-app.\n\nInstalling packages. This might take a couple of minutes.\nInstalling react, react-dom, …
Run Code Online (Sandbox Code Playgroud)

reactjs create-react-app yarnpkg

2
推荐指数
1
解决办法
4435
查看次数

.yarnrc 使用用户名和密码进行私有注册表身份验证

有关如何迁移到 Yarn 2 的说明尚不清楚,并且如何对使用用户名和密码的私有注册表进行身份验证也不清楚。

这是我的文件的内容.npmrc

registry=https://pkgs.dev.azure.com/<private-path>/registry/
always-auth=true

//pkgs.dev.azure.com/<private-path>/registry/:username=${NPM_USER}
//pkgs.dev.azure.com/<private-path>/registry/:_password=${NPM_TOKEN}
Run Code Online (Sandbox Code Playgroud)

文档.yarnrc.yml仅提到如何处理令牌,但没有提及有关用户名的任何内容。我也尝试过使用npmAuthIdent,但我不知道正确的语法。

如何使用yarn 2 通过我的私人注册表进行身份验证?目前我必须降级回yarn 1,以便我可以使用npmrc 文件

yarnpkg yarn-v2 .npmrc yarnpkg-v2

2
推荐指数
1
解决办法
9891
查看次数

如何强制yarn覆盖yarn.lock版本并安装最新版本?

我想保持所有其他软件包版本不变,但将一个软件包升级到最新版本。我怎样才能用纱线做到这一点?

我知道我可以删除yarn.lock,然后运行yarn install,但我认为这会升级每个包,这是我不想要的。我只想要最新版本的node-sass,并覆盖我的版本yarn.lock

如何才能做到这一点?

yarnpkg

2
推荐指数
1
解决办法
4004
查看次数

Yarn berry 安装node_modules

node.js 版本:16.14.0\nyarn 版本:3.1.1\nmacOS:11.6.4(Big Sur)

\n

我建立并继续致力于纱线工作区项目。我在 github 存储库上提交了包括.yarn, .pnp.cjs,在内的所有文件。.pnp.loader.mjs

\n

然而,我更换电脑后遇到了问题。

\n

当我尝试克隆存储库并yarn install从桌面计算机执行时,它删除了文件并安装.pnp.cjs了..pnp.loader.mjsnode_modules

\n

其他同事没有遇到这个问题,我的另一台笔记本电脑上也没有遇到这个问题。Node和其他版本是一样的。

\n

我多次尝试删除并重新安装该存储库,但结果也是一样。

\n

我知道当依赖项包含二进制文件时,尽管使用 Yarn berry,仍然可以安装 node_modules。但我认为情况并非如此。

\n

node_modules下面是安装时的 shell 消息。

\n
\xe2\x9e\xa4 YN0000: \xe2\x94\x8c Resolution step\n\xe2\x9e\xa4 YN0000: \xe2\x94\x94 Completed\n\xe2\x9e\xa4 YN0000: \xe2\x94\x8c Fetch step\n\xe2\x9e\xa4 YN0000: \xe2\x94\x94 Completed in 0s 353ms\n\xe2\x9e\xa4 YN0000: \xe2\x94\x8c Link step\n\xe2\x9e\xa4 YN0076: \xe2\x94\x82 @swc/core-android-arm-eabi@npm:1.2.126 The darwin-x64 architecture is incompatible with this module, link skipped.\n\xe2\x9e\xa4 YN0076: \xe2\x94\x82 @swc/core-android-arm64@npm:1.2.126 The darwin-x64 architecture …
Run Code Online (Sandbox Code Playgroud)

node-modules yarnpkg yarn-workspaces yarnpkg-v3

2
推荐指数
1
解决办法
2046
查看次数

如何在某个日期之前安装节点包及其依赖项?

是否有可能安装节点包(无论是由npmyarn)及其在某个日期之前发布的依赖项?看起来这在技术上是可行的,因为所有版本都有相应的发布日期,但我没有看到任何具体的方法。

有时,不可能获得与发布日期要求相对应的一组软件包。在这种情况下,我们可以获取尽可能早的版本。

dependencies node.js npm yarnpkg yarnpkg-v2

2
推荐指数
1
解决办法
1066
查看次数

为什么yarn 会删除我的package.json 中的“private”:“true”?

当我yarn在包含带有字段的 package.json 文件的目录中运行时"private": "true",,此行将被静默删除。例如,yarn 3.1.0 中有此行​​为,但 npm 8.5.5 中没有此行为。

npm package.json yarnpkg yarn-v3

2
推荐指数
1
解决办法
499
查看次数

Nuxt 致命错误 TypeError:无法解构“this”的属性“nuxt”,因为它未定义

当我尝试构建 docker 映像时,在运行后出现此错误yarn build

\n
#0 0.496 yarn run v1.22.19                                                                                                                                                                                         \n#0 0.531 $ nuxt build\n#0 1.538 \xe2\x84\xb9\xef\xb8\x8f Using Tailwind CSS from ~/assets/css/tailwind.css\n#0 1.543 \n#0 1.543  FATAL  Cannot destructure property 'nuxt' of 'this' as it is undefined.\n#0 1.543 \n#0 1.543   at postcss8Module (node_modules/@nuxt/postcss8/dist/index.js:15:10)\n#0 1.543   at installModule (node_modules/@nuxt/kit/dist/index.mjs:416:9)\n#0 1.543   at async setup (node_modules/@nuxtjs/tailwindcss/dist/module.mjs:186:7)\n#0 1.543   at async ModuleContainer.normalizedModule (node_modules/@nuxt/kit/dist/index.mjs:167:5)\n#0 1.543   at async ModuleContainer.addModule (node_modules/@nuxt/core/dist/core.js:239:20)\n#0 1.543   at async ModuleContainer.ready (node_modules/@nuxt/core/dist/core.js:51:7)\n#0 1.543   at async Nuxt._init (node_modules/@nuxt/core/dist/core.js:478:5)\n#0 1.543 \n#0 1.548 \n#0 1.548 \xe2\x95\xad\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x95\xae\xe2\x94\x82                                                                              \xe2\x94\x82\xe2\x94\x82 …
Run Code Online (Sandbox Code Playgroud)

docker yarnpkg nuxt.js

2
推荐指数
2
解决办法
7667
查看次数

如何解决sh:react-scripts:找不到命令?

我使用create-react-app生成了一个应用程序。

create-react-app myapp
Run Code Online (Sandbox Code Playgroud)

当我运行yarn start或npm start时,出现以下错误:

反应脚本开始

sh:react-scripts:找不到命令npm ERR!文件sh npm ERR!代码ELIFECYCLE npm ERR!errno ENOENT npm ERR!syscall产生npm ERR!myapp@0.1.0开始:react-scripts startnpm错误!产生ENOENT npm ERR!npm ERR!在myapp@0.1.0启动脚本处失败。npm ERR!npm可能不是问题。上面可能还有其他日志记录输出。

当我运行npm ls反应时:

myapp@0.1.0 /Users/johnno/foosball 
??? react@16.2.0
Run Code Online (Sandbox Code Playgroud)

存在react-scripts。

这是我的package.json:

{
  "name": "myapp",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^16.2.0",
    "react-dom": "^16.2.0",
    "react-redux": "^5.0.6",
    "react-router": "^4.2.0",
    "react-scripts": "1.0.17",
    "redux": "^3.7.2",
    "yarn": "^1.3.2"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
}
Run Code Online (Sandbox Code Playgroud)

我试图从建议这个,但无济于事。如何解决此问题?

macos reactjs create-react-app yarnpkg

1
推荐指数
1
解决办法
4324
查看次数

无法在我的 react 项目中使用 npm 添加 node-sass 我正在我的 mac 上开发

webpack用作我的react应用程序的加载程序。node-sass是我正在使用的装载机之一。我的操作系统是Mac OSX High Sierra. 我目前正在使用node v8.9.3. 我无法使用安装它,npm但可以使用yarn. 这是我使用时的结果npm

Unable to save binary /Users/user/Documents/react/react.js-essential-training/node_modules/node-sass/vendor/darwin-x64-57 : { Error:
EACCES: permission denied, mkdir '/Users/user/Documents/react/react.js-essential-training/node_modules/node-sass/vendor'
at Object.fs.mkdirSync (fs.js:885:18)
at sync (/Users/user/Documents/react/react.js-essential-training/node_modules/mkdirp/index.js:71:13)
at Function.sync (/Users/user/Documents/react/react.js-essential-training/node_modules/mkdirp/index.js:77:24)
at checkAndDownloadBinary (/Users/user/Documents/react/react.js-essential-training/node_modules/node-sass/scripts/install.js:111
:11)
at Object.<anonymous> (/Users/user/Documents/react/react.js-essential-training/node_modules/node-sass/scripts/install.js:154:1)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
errno: -13,
code: 'EACCES',
syscall: 'mkdir',
path: '/Users/user/Documents/react/react.js-essential-training/node_modules/node-sass/vendor' }

> node-sass@4.7.2 postinstall …
Run Code Online (Sandbox Code Playgroud)

macos node.js npm node-sass yarnpkg

1
推荐指数
1
解决办法
1696
查看次数

Git预推钩在不止一次检查的情况下不会中止推送

在git hooks中 - 我想在推送之前检查jshint错误和纱线完整性检查,所以我在推送前添加了以下内容.所以它是这样的 -

    # Pre-push hooks
    # Lint stuff before committing
    grunt jshint eslint tslint
    # Verifies that versions and hashed value of the package contents 
      in the project’s package.json matches that of yarn’s lock file.
    yarn check --integrity
Run Code Online (Sandbox Code Playgroud)
  • 这里如果jshint给出错误但是如果纱线完整性检查通过,它仍然允许推送.如果纱线失效,它将中止.
  • 如果我颠倒了订单,那么如果纱线检查失败并且如果jshint通过,那么它也会推动.如果jshint失败,它将中止.

因此,只有在最后一次检查失败时它才会失败,而在其他情况下,它会指出错误但仍会推送它

git shell githooks yarnpkg

1
推荐指数
1
解决办法
445
查看次数