gpt4 book ai didi

node.js - 无法在 devDependency 上找到文件

转载 作者:太空宇宙 更新时间:2023-11-03 22:24:13 25 4
gpt4 key购买 nike

我有一个如下所示的 package.json 文件:

{
"name": "basics",
"version": "0.1.0",
"private": true,
"devDependencies": {
"concurrently": "3.4.0",
"react-scripts": "1.0.14",
"fsr-helpers": "file:../../fsr-helpers"
},
"dependencies": {
"history": "4.3.0",
"prop-types": "15.6.0",
"react": "16.0.0",
"react-dom": "16.0.0",
"react-router-dom": "4.2.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"eject": "react-scripts eject",
"e2e": "nightwatch",
"run-e2e": "./node_modules/.bin/concurrently -k 'npm start' 'npm run e2e'"
}
}

在安装软件包期间,我收到以下错误消息:

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: core-js@2.4.1 (node_modules/fsr-helpers/node_modules/babel-polyfill/node_modules/core-js):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/developer/Desktop/fullstack-react-code/routing/basics/node_modules/.staging/core-js-4f416826' -> '/home/developer/Desktop/fullstack-react-code/fsr-helpers/node_modules/babel-polyfill/node_modules/core-js'

npm ERR! Maximum call stack size exceeded

npm ERR! A complete log of this run can be found in:
npm ERR! /home/developer/.npm/_logs/2018-03-01T21_00_59_918Z-debug.log

我想,发生错误的原因是:

"fsr-helpers": "file:../../fsr-helpers"

devDependency中。该文件夹的结构如下所示: enter image description here

package.json的内容是:

{
"name": "fsr-helpers",
"version": "1.0.0",
"private": true,
"main": "dist/index.js",
"dependencies": {
"react": "15.5.4",
"react-dom": "15.5.4"
},
"scripts": {
"test": "jest src --watch",
"compile": "./node_modules/.bin/babel -d dist/ src/"
},
"devDependencies": {
"babel-cli": "6.24.0",
"babel-core": "6.24.0",
"babel-jest": "19.0.0",
"babel-plugin-transform-es2015-modules-commonjs": "6.24.0",
"babel-preset-es2016": "6.22.0",
"babel-preset-react": "6.23.0",
"babel-preset-stage-2": "6.22.0",
"enzyme": "2.8.2",
"jest": "19.0.2",
"react-test-renderer": "16.0.0"
}
}

为什么我会收到错误:

Maximum call stack size exceeded

"fsr-helpers": "file:../../fsr-helpers" 是什么意思?

最佳答案

“文件:”语法是一种使用包的本地路径的方法:https://docs.npmjs.com/files/package.json#local-paths

在您的情况下,它正在寻找从 package.json (../../) 向上 2 个级别的包如果我正确读取您的文件夹结构(位于项目内直接的文件夹中),则应该是 file:./fsr-helpers

关于node.js - 无法在 devDependency 上找到文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49058706/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com