我有一个看起来如下的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"
devDependencies
中的
,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"
是什么意思?
答案 0 :(得分:0)
“file:”语法是一种使用包的本地路径的方法:https://docs.npmjs.com/files/package.json#local-paths
在你的情况下,它正在寻找package.json(../../)中的2级包
如果我正确地读取了您的文件夹结构(在项目中的文件夹中),它应该是file:./fsr-helpers
。