【发布时间】:2020-08-06 19:04:04
【问题描述】:
我从 truffle 下载了反应框,并想使用 npm install 和 start 但两者都不起作用。我看了其他帖子说:
- 设置路径
"%SystemRoot%\system32",在admin中打开cmd然后使用npm start - npm config set ignore-scripts false
- 确认我在包含
package.json的目录中
这是下载的盒子的样子(我曾经在这两个目录中运行 npm start 并安装):
这是我在 SupChainBasicVersion 文件夹和客户端文件夹中使用 npm start 的错误日志:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Users\\Heraxia\\AppData\\Local\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\Heraxia\\AppData\\Local\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start'
1 verbose cli ]
2 info using npm@6.14.6
3 info using node@v12.18.3
4 verbose stack Error: ENOENT: no such file or directory, open 'C:\Users\Heraxia\SupChainBasicVersion\package.json'
5 verbose cwd C:\Users\Heraxia\SupChainBasicVersion
6 verbose Windows_NT 10.0.18363
7 verbose argv "C:\\Users\\Heraxia\\AppData\\Local\\nodejs\\node.exe" "C:\\Users\\Heraxia\\AppData\\Local\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
8 verbose node v12.18.3
9 verbose npm v6.14.6
10 error code ENOENT
11 error syscall open
12 error path C:\Users\Heraxia\SupChainBasicVersion\package.json
13 error errno -4058
14 error enoent ENOENT: no such file or directory, open 'C:\Users\Heraxia\SupChainBasicVersion\package.json'
15 error enoent This is related to npm not being able to find a file.
16 verbose exit [ -4058, true ]
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Users\\Heraxia\\AppData\\Local\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\Heraxia\\AppData\\Local\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start'
1 verbose cli ]
2 info using npm@6.14.6
3 info using node@v12.18.3
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle client@0.1.0~prestart: client@0.1.0
6 info lifecycle client@0.1.0~start: client@0.1.0
7 verbose lifecycle client@0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle client@0.1.0~start: PATH: C:\Users\Heraxia\AppData\Local\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Heraxia\SupChainBasicVersion\client\node_modules\.bin;C:\Python38\Scripts\;C:\Python38\;C:\Program Files\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Users\Heraxia\AppData\Local\nodejs\;C:\ProgramData\chocolatey\bin;C:\Windows\system32;C:\Users\Heraxia\AppData\Local\Microsoft\WindowsApps;C:\Users\Heraxia\AppData\Local\VSCode\bin;C:\Program Files\Java\jdk-11.0.8\bin;C:\Users\Heraxia\AppData\Roaming\npm
9 verbose lifecycle client@0.1.0~start: CWD: C:\Users\Heraxia\SupChainBasicVersion\client
10 silly lifecycle client@0.1.0~start: Args: [ '/d /s /c', 'react-scripts start' ]
11 silly lifecycle client@0.1.0~start: Returned: code: 1 signal: null
12 info lifecycle client@0.1.0~start: Failed to exec start script
13 verbose stack Error: client@0.1.0 start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Users\Heraxia\AppData\Local\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:315:20)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\Heraxia\AppData\Local\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:315:20)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid client@0.1.0
15 verbose cwd C:\Users\Heraxia\SupChainBasicVersion\client
16 verbose Windows_NT 10.0.18363
17 verbose argv "C:\\Users\\Heraxia\\AppData\\Local\\nodejs\\node.exe" "C:\\Users\\Heraxia\\AppData\\Local\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v12.18.3
19 verbose npm v6.14.6
20 error code ELIFECYCLE
21 error errno 1
22 error client@0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the client@0.1.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
请帮助我,我想我会因为这些错误而发疯。我已经工作了2个多小时,我不知道该怎么办。
感谢任何愿意花时间帮助我的人。
【问题讨论】:
-
看起来你在不包含 package.json 的地方运行
npm install。我认为您必须在client文件夹中进行操作 -
@yash 我在 SupChainBasicVersion 和客户端文件夹中都这样做了,但总是同样的错误
-
Ciao,你从哪里下载的这些文件?能给我看看链接吗?
-
@GiovanniEsposito 从这里trufflesuite.com/boxes/react
-
@Tameiki 如果我看到类似“Good to Go!您的 Truffle Box 已安装并准备就绪。”在我的 localhost:3000 上,这意味着我解决了你的问题?抱歉,我从来没有用过松露盒……
标签: node.js npm npm-install truffle npm-start