【问题标题】:React Native application; Error starting packager: Error: EPERM: operation not permitted反应原生应用程序;启动打包程序时出错:错误:EPERM:不允许操作
【发布时间】:2018-08-18 03:13:36
【问题描述】:

Windows 10 我整天都在努力寻找解决方案,但没有找到合适的答案。我正在尝试创建一个反应原生项目。今天早些时候,我能够超越创建应用程序的要点,然后我在尝试使用 Expo 同步我的 android 设备时遇到了困难。在修改我的网络设置时,我似乎搞砸了一些事情,因为现在我什至无法到达命令提示符下的 Expo 屏幕。我可以在终端中创建应用程序,然后当我输入“npm start”时,它说它正在启动打包程序,然后大约 10 秒后超时并给出一些错误消息。我已经卸载并重新安装了 nodejs,将我的项目移动到一个全新的文件夹,问题仍然存在。

这是在命令提示符中打印出来的代码

npm 错误!代码生命周期
npm 错误!错误号 1
npm 错误! todoapp@0.1.0 开始:react-native-scripts start
npm 错误!退出状态 1
npm 错误!
npm 错误!在 todoapp@0.1.0 启动脚本失败。
npm 错误!这可能不是 npm 的问题。上面可能有额外的日志输出。

npm 错误!可以在以下位置找到此运行的完整日志:
npm 错误! C:\Users\cembr\AppData\Roaming\npm-cache_logs\2018-08-18T03_05_05_427Z-debug.log

这里是调试日志:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\cembr\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start' ]
2 info using npm@6.4.0
3 info using node@v8.11.4
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle todoapp@0.1.0~prestart: todoapp@0.1.0
6 info lifecycle todoapp@0.1.0~start: todoapp@0.1.0
7 verbose lifecycle todoapp@0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle todoapp@0.1.0~start: PATH: C:\Users\cembr\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\cembr\OneDrive\Documents\Web Design\todoapp\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS\;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Gpg4win\..\GnuPG\bin;C:\Program Files\Microsoft VS Code\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Yarn\bin\;C:\Program Files\nodejs\;C:\Users\cembr\AppData\Local\Microsoft\WindowsApps;C:\Users\cembr\AppData\Local\Yarn\bin;C:\Users\cembr\AppData\Roaming\npm
9 verbose lifecycle todoapp@0.1.0~start: CWD: C:\Users\cembr\OneDrive\Documents\Web Design\todoapp
10 silly lifecycle todoapp@0.1.0~start: Args: [ '/d /s /c', 'react-native-scripts start' ]
11 silly lifecycle todoapp@0.1.0~start: Returned: code: 1  signal: null
12 info lifecycle todoapp@0.1.0~start: Failed to exec start script
13 verbose stack Error: todoapp@0.1.0 start: `react-native-scripts start`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Users\cembr\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:304:16)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at EventEmitter.emit (events.js:214:7)
13 verbose stack     at ChildProcess.<anonymous> (C:\Users\cembr\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at ChildProcess.emit (events.js:214:7)
13 verbose stack     at maybeClose (internal/child_process.js:925:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid todoapp@0.1.0
15 verbose cwd C:\Users\cembr\OneDrive\Documents\Web Design\todoapp
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\cembr\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v8.11.4
19 verbose npm  v6.4.0
20 error code ELIFECYCLE
21 error errno 1
22 error todoapp@0.1.0 start: `react-native-scripts start`
22 error Exit status 1
23 error Failed at the todoapp@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 ]

【问题讨论】:

  • 我应该补充一点,我使用的是 Windows 10。下面的两个答案似乎都指的是 Linux 系统。

标签: javascript node.js reactjs mobile native


【解决方案1】:

尝试输入这些命令

sudo sysctl -w fs.inotify.max_user_instances=1024
sudo sysctl -w fs.inotify.max_user_watches=12288

发现于 https://github.com/react-community/create-react-native-app/issues/533

【讨论】:

    【解决方案2】:

    这一定是 NPM 的错误,并且通过使用

    杀死节点进程

    kill -9 进程的PID你可以重新启动NPM然后它会工作。

    用于查找进程

    lsof -i:8081 然后

    kill -9 节点进程的PID

    【讨论】:

    • 你知道windows对应的代码吗?我在 Windows 10 上
    • 不,我给它的命令是针对 Windows 的 Linux 的,你还必须杀死你之前启动的 NPM 进程,然后重新启动它
    • 查看此链接stackoverflow.com/questions/11276249/…@ChanceEmbrey
    猜你喜欢
    • 2019-01-31
    • 2019-10-20
    • 2018-06-07
    • 2021-11-04
    • 1970-01-01
    • 2021-04-29
    • 1970-01-01
    • 2019-01-09
    • 1970-01-01
    相关资源
    最近更新 更多