expo start命令未运行

时间:2018-12-25 04:26:16

标签: node.js react-native npm expo

以前,使用expo使用expo start处理我的React本机项目。现在它不起作用,因此我重新安装了node.js。我使用expo安装了npm install -g expo-cli,但是expo start给了我:

'expo' is not recognized as an internal or external command, operable program or batch file.

我检查了错误文件,这就是它的意思:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start' ]
2 info using npm@6.4.1
3 info using node@v10.14.2
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle @~prestart: @
6 info lifecycle @~start: @
7 verbose lifecycle @~start: unsafe-perm in lifecycle true
8 verbose lifecycle @~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Linda\Documents\U of T Engineering\2018\Jobs\IoT for Education\alarmApp\node_modules\.bin;C:\Python27\;C:\Python27\Scripts;C:\ProgramData\Boxstarter;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\TDM-GCC-64\bin;C:\Program Files\Git\cmd;C:\Python3;C:\Python3\Scripts;C:\Program Files\PuTTY\;C:\Program Files\MATLAB\R2017b\bin;C:\Go\bin;C:\WINDOWS\System32\OpenSSH\;C:\ProgramData\chocolatey\bin;C:\xampp\php;C:\ProgramData\ComposerSetup\bin;C:\Program Files\nodejs\;C:\Users\Linda\AppData\Local\Programs\Python\Python36-32\Scripts\;C:\Users\Linda\AppData\Local\Programs\Python\Python36-32\;C:\Users\Linda\AppData\Local\Microsoft\WindowsApps;C:\Users\Linda\AppData\Local\atom\bin;C:\altera_lite\16.0\modelsim_ase\win32aloem;C:\Users\Linda\AppData\Local\Microsoft\WindowsApps;C:\Users\Linda\go\bin;C:\Program Files\Docker Toolbox;;C:\Program Files\Docker Toolbox;C:\Program Files\Docker Toolbox;C:\Users\Linda\AppData\Roaming\Composer\vendor\bin;C:\Users\Linda\AppData\Roaming\npm
9 verbose lifecycle @~start: CWD: C:\Users\Linda\Documents\U of T Engineering\2018\Jobs\IoT for Education\alarmApp
10 silly lifecycle @~start: Args: [ '/d /s /c', 'expo start' ]
11 silly lifecycle @~start: Returned: code: 1  signal: null
12 info lifecycle @~start: Failed to exec start script
13 verbose stack Error: @ start: `expo start`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:182:13)
13 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:182:13)
13 verbose stack     at maybeClose (internal/child_process.js:962:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
14 verbose pkgid @
15 verbose cwd C:\Users\Linda\Documents\U of T Engineering\2018\Jobs\IoT for Education\alarmApp
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v10.14.2
19 verbose npm  v6.4.1
20 error code ELIFECYCLE
21 error errno 1
22 error @ start: `expo start`
22 error Exit status 1
23 error Failed at the @ start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

我不知道expo为什么停止工作以及错误文件的含义。请帮忙!谢谢。

5 个答案:

答案 0 :(得分:0)

我修复了!我不知道为什么会这样,但是:

npm i expo-cli,然后运行npm start

答案 1 :(得分:0)

尝试此命令

expo start --config ./app/app.json -c

npm start -- -c

答案 2 :(得分:0)

首先检查/users/[you]/.npm-global/bin是否在您的路径中。

echo $PATH 如果不存在,则需要将其添加到路径中。

在外壳类型中:

export PATH=$PATH:~/.npm-global/bin source ~/.bash_profile

如果您跑步 > expo

现在在外壳中,该命令应该可以识别...

答案 3 :(得分:0)

清除缓存后,使用vscode终端

答案 4 :(得分:0)

出于某种原因,更新弄乱了路径。所以我只好去编辑环境变量,在系统变量下的“Path”变量中再添加一行。

不要碰新的。单击系统变量部分下的“路径”并在那里添加一个新行。使用 "%USERPROFILE%\AppData\Roaming\npm"

然后打开一个新的命令行,它应该可以工作了。