После того, как я перенес свой проект React на Github, я могу его клонировать, но он говорит, что не может решить «трюфельный контракт», даже если я его установил - PullRequest
0 голосов
/ 11 января 2019

У меня есть реактивный проект, который использует IPFS и web3 с Truffle. После того как я перенесу все файлы в новый репозиторий, я клонирую его, чтобы посмотреть, смогу ли я его запустить. Даже при том, что я 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
...