Npm 如何更改index.js的位置

Npm 如何更改index.js的位置,npm,Npm,我正试图从以下方面重新安排项目回购: public/ src/ | |---- index.js package.json 为此: public/ frontend/ | |---- src/ | |---- index.js package.json 当我重新安排时,npm start将失败,并显示以下消息: Could not find a required file. Name: index.js Searched in: /Users/sahandza

我正试图从以下方面重新安排项目回购:

public/
src/
|
|---- index.js
package.json
为此:

public/
frontend/
|
|---- src/
      |
      |---- index.js
package.json
当我重新安排时,
npm start
将失败,并显示以下消息:

Could not find a required file.
  Name: index.js
  Searched in: /Users/sahandzarrinkoub/Documents/Programming/DH2642/Sentify/repo/Sentify/Sentify/src
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Sentify@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the Sentify@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
因此,我进入package.json文件并添加了以下内容:

"main": "frontend/src/index.js",
奇怪的是什么都没变。npm告诉我,它仍然在同一个目录中查找
index.js

Could not find a required file.
  Name: index.js
  Searched in: /Users/sahandzarrinkoub/Documents/Programming/DH2642/Sentify/repo/Sentify/Sentify/src
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sentify@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the sentify@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
我如何才能成功地将我的项目重新安排到这个组织中?我如何告诉npm在哪里查找index.js

我还尝试:

"main": "/Users/sahandzarrinkoub/Documents/Programming/DH2642/Sentify/repo/Sentify/Sentify/frontend/src/index.js",

您以前在
main
中有什么路径?当时它工作了吗?它没有在package.json中定义。它工作得很好。此外,恢复原始文件层次结构,但保留package.json中新文件层次结构的“main”字段不会导致崩溃。“main”字段被忽略,一切正常:/n您运行的是什么操作系统?雨衣?你试过
”/frontend/src/index.js“
”吗?是的,Mac。我试过了,同样的事情。npm完全忽略package.json中的
“main”
字段