使用expo来处理我以前使用expo start
的react原生项目。现在它不起作用了,所以我重新安装了node.js
。我使用npm install -g expo-cli
安装了expo
,但是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条答案
按热度按时间piok6c0g1#
我修好了!我不知道为什么会这样,但是:
npm i expo-cli
,然后运行npm start
。mum43rcc2#
首先检查
/users/[you]/.npm-global/bin
是否在您的路径中。echo $PATH
如果没有,您需要将其添加到路径中。在外壳类型中:
export PATH=$PATH:~/.npm-global/bin source ~/.bash_profile
如果运行
> expo
在shell中,命令应该可以被识别...
odopli943#
清除缓存后,使用vscode终端
f0ofjuux4#
试试这些命令,我已经解决了这个问题。试试吧
pjngdqdw5#
由于某些原因,更新时弄乱了路径,所以我不得不去编辑环境变量,并在系统变量下的变量“Path”中添加另一行。
不要点击new。点击系统变量部分下的“Path”,在那里添加一个新行。使用
"%USERPROFILE%\AppData\Roaming\npm"
。然后打开一个新的命令行,它应该工作。