我有一个使用Truffle的IPFS和web3的react项目。将所有文件推送到新的存储库后,我将其克隆以查看是否可以运行它。即使我npm install truffle-contract
总是说“找不到模块:无法解析'D:\ COMP495 \ TEST \ tryagin \ IPFS_Article_Storage_DApp \ client \ src'中的'松露合同'”
这是package.json文件
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"bootstrap": "^4.1.1",
"jquery": "^3.3.1",
"react": "^16.4.2",
"react-dom": "^16.4.2",
"react-scripts": "1.1.4",
"truffle-contract": "^4.0.0-next.0",
"web3": "^1.0.0-beta.35"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"link-contracts": "run-script-os",
"link-contracts:linux:darwin": "cd src && ln -s ../../build/contracts contracts",
"link-contracts:win32": "cd src && mklink \\D contracts ..\\..\\build\\contracts"
},
"devDependencies": {
"run-script-os": "^1.0.3"
},
"description": "This project was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app).",
"main": "index.js",
"author": "",
"license": "ISC"
}
克隆存储库后,我npm install
,npm install ipfs-api
,npm install truffle-contract
,npm install truffle
。然后,我尝试使用npm run start
运行它,但显示无法解决“松露合同”
这就是我的.js文件中所指的内容
import truffleContract from "truffle-contract";
我计算机上的原始项目很好。当我推送然后克隆它时,我只是无法使其运行。我可能会补充说,当我npm install truffle-contract
时,我可能会遇到错误。我不知道是否有另一个版本,或者是否需要安装其他依赖项。这是安装后得到的。
ImportError: cannot import name _remove_dead_weakref
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (D:\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:345:16)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "D:\\nodejs\\node.exe" "D:\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\COMP495\TEST\DAPP_IPFS_FileSharing\client\node_modules\scrypt
gyp ERR! node -v v10.13.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN ajv-keywords@3.2.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN bootstrap@4.1.1 requires a peer of popper.js@^1.14.3 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! scrypt@6.0.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the scrypt@6.0.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\l_zha\AppData\Roaming\npm-cache\_logs\2019-01-11T02_05_03_299Z-debug.log