我使用macbook创建了一个应用程序,在mac上工作正常。但我尝试在 windows 上运行同一个项目,但不起作用。
当我运行:npm install时,我收到了这样的反馈:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY:
fsevents@^1.1.3 (node_modules\react-scripts\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY:
Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY:
fsevents@^1.1.2 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY:
Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY:
fsevents@^1.0.0 (node_modules\webpack-dev-server\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3:
wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN ajv-keywords@3.1.0 requires a peer of ajv@^6.0.0 but none was installed .
在我的 package.json 上我有这个:
{
"name": "---",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-router": "^4.2.0",
"react-scripts": "^1.1.4",
"styled-components": "^2.4.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
据我所知,由于某种原因,操作系统之间存在不兼容性,但这不应该发生,对吧?
ps:我使用 npx create-react-app my-app 创建应用测试并且正常工作!但是,为什么我目前的项目有效,为什么,OMG?
ps2:我也尝试安装: npm i -f 忽略 WARNs 但 npm start 剂量工作,我有同样的错误:< / p>
> react-scripts start
Could not find a required file.
Name: index.js
Searched in: D:\projetos\cesarcabral\portflio\src
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! portflio@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the portflio@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
额外信息:
答案 0 :(得分:0)
好像你需要安装ajv
:
npm WARN ajv-keywords@3.1.0需要ajv@^6.0.0的对等方但没有安装
并且src/index.js
丢失了。