【发布时间】:2021-07-25 21:38:10
【问题描述】:
当前行为:
我在 mac 上有一个本地开发环境,我从它 git push 到我的远程仓库。我的生产服务器在 linxu 上,我在那里提取了我的 repo。通常这可以正常工作,但这次我遇到了一个错误,我找不到解决方法:(
npm ci 在 linux 上失败,因为 fsevents
重现步骤:
$npm ci
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for fsevents@2.2.1: wanted {"os":"darwin"} (current: {"os":"linux","arch":"x64"})
npm ERR! notsup Valid OS: darwin
npm ERR! notsup Valid Arch: undefined
npm ERR! notsup Actual OS: linux
npm ERR! notsup Actual Arch: x64
我的尝试:
-
移除本地node_modules & package-lock.json
$ rm package-lock.json$ rm -rf node_modules -
通过
$ sudo npm i -g npm更新全局npm -
$ npm install重新安装本地node_modules -
正在执行
$ npm ci -
也试过
$ npm cache --force clean -
也试过
$ npm audit fix
问题:
我无法找出导致问题的依赖项,因为我的 Mac 上一切正常。但我的谷歌云 linux 服务器似乎与 fsevents 有问题,因为它不兼容。而且我不知道如何修复它或我应该删除什么。因此,发生此错误后,我无法再使用我的服务器了。
我的 package.json
{
"name": "app-ant",
"version": "0.1.0",
"private": true,
"dependencies": {
"@dnd-kit/core": "^3.0.3",
"@google-cloud/storage": "^5.8.3",
"@react-pdf/renderer": "^2.0.14",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"antd": "^4.15.1",
"array-move": "^3.0.1",
"axios": "^0.21.1",
"bizcharts": "^4.1.9",
"core-js": "3.3",
"cross-env": "^7.0.3",
"exif-js": "^2.3.0",
"file-saver": "^2.0.5",
"firebase": "^8.7.1",
"framer-motion": "^4.1.17",
"gantt-schedule-timeline-calendar": "^3.6.6",
"google-map-react": "^2.1.9",
"google-maps-react": "^2.0.6",
"i": "^0.3.6",
"intl-tel-input": "^17.0.12",
"moment-timezone": "^0.5.33",
"npm": "^6.14.12",
"react": "^16.8.0",
"react-beautiful-dnd": "^13.1.0",
"react-color": "^2.19.3",
"react-csv": "^2.0.3",
"react-dom": "^16.14.0",
"react-firebase-hooks": "^3.0.4",
"react-full-screen": "^1.0.2",
"react-geocode": "^0.2.3",
"react-google-autocomplete": "^1.2.6",
"react-google-charts": "^3.0.15",
"react-infinite-scroller": "^1.2.4",
"react-places-autocomplete": "^7.3.0",
"react-quill": "^1.3.5",
"react-router-dom": "^5.2.0",
"react-scripts": "^4.0.3",
"react-shortcuts": "^2.1.0",
"react-simple-maps": "^2.3.0",
"react-sortable-hoc": "^1.11.0",
"react-to-print": "^2.12.4",
"react-tracking": "^8.1.0",
"react-transition-group": "^2.9.0",
"recharts": "^2.0.9",
"typescript": "^4.2.4",
"vcards-js": "^2.10.0",
"vcf": "^2.1.0",
"xmp-js": "0.0.5"
},
"scripts": {
"start": "cross-env HOST=website.com react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@iconify-icons/bx": "^1.1.0",
"@iconify-icons/el": "^1.1.0",
"@iconify-icons/mdi": "^1.1.14",
"@iconify/react": "^1.1.4"
}
}
npm_dependencies_tree 输出: npm ls --all
https://drive.google.com/file/d/1-yZ289sT3kOUPtb-KzewwSlGdF22jXZ6/view?usp=sharing
提前感谢您对我的问题的支持。
【问题讨论】: