使用buffer-layout使用任何依赖项时,我都遇到了问题。问题是这个使用一些文件的库存在于一个名为src
. 但是,当我尝试列出它的子目录时,我发现那里没有任何调用src
。
这导致了很多问题,例如No such file or directory
.
我尝试删除node_modules
然后npm i
。我试过了npm r buffer-layout && npm i buffer-layout
。没有什么能解决问题。
笔记:
- 我正在开发一个由
npx create-react-app
. - 每当我像这样导入此依赖项时,我都会遇到问题
import { TOKEN_LIST_URL } from "@jup-ag/core";
- 我只有在这样做时才会遇到这个问题
npm start
。没有问题npm run-script build
。 - 我的
package.json
样子:
{
"name": "AppName",
"version": "0.1.0",
"private": true,
"dependencies": {
"@emotion/react": "^11.7.1",
"@emotion/styled": "^11.6.0",
"@jup-ag/core": "^1.0.0-beta.2",
"@jup-ag/react-hook": "^1.0.0-beta.2",
"@material-ui/core": "^4.12.3",
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.0.0-alpha.60",
"@mui/icons-material": "^5.2.5",
"@mui/material": "^5.2.5",
"@solana/buffer-layout": "^4.0.0",
"@solana/wallet-adapter-base": "^0.8.1",
"@solana/wallet-adapter-react": "^0.14.1",
"@solana/wallet-adapter-react-ui": "^0.7.0",
"@solana/wallet-adapter-wallets": "^0.13.0",
"@solana/web3.js": "^1.31.0",
"@testing-library/jest-dom": "^5.16.1",
"@testing-library/react": "^12.1.2",
"@testing-library/user-event": "^13.5.0",
"@typescript-eslint/parser": "^5.8.1",
"assert": "^2.0.0",
"axios": "^0.24.0",
"buffer-layout": "^1.2.2",
"crypto-browserify": "^3.12.0",
"fs": "0.0.1-security",
"jsbi": "^3.2.5",
"material-ui-popup-state": "^2.0.0",
"path-browserify": "^1.0.1",
"process": "^0.11.10",
"react": "^17.0.2",
"react-async-hook": "^4.0.0",
"react-dom": "^17.0.2",
"react-dotenv": "^0.1.3",
"react-router-dom": "^6.2.1",
"react-scripts": "5.0.0",
"web-vitals": "^2.1.2"
},
"scripts": {
"start": "react-dotenv && react-scripts start",
"test": "react-scripts test",
"eject": "react-scripts eject",
"build": "webpack --config webpack.config.js"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"react-dotenv": {
"whitelist": [
"cluster",
"WALLET_PRIVATE_KEY"
]
},
"devDependencies": {
"@babel/core": "^7.16.5",
"@babel/preset-env": "^7.16.5",
"@babel/preset-react": "^7.16.5",
"babel-loader": "^8.2.3",
"css-loader": "^6.5.1",
"file-loader": "^6.2.0",
"url-loader": "^4.1.1",
"webpack": "^5.65.0",
"webpack-cli": "^4.9.1"
}
}
请问有什么想法吗?