簡體   English   中英

npm 錯誤! 代碼 ELIFECYCLE(起始問題)

[英]npm ERR! code ELIFECYCLE (starting issue)

感謝您閱讀本文並幫助解決問題。

我正在嘗試在 Windows 機器上運行 nodejs 並在安裝 expo-cli 后啟動 expo 客戶端。 最初它可以工作,除了實時刷新或任何其他刷新不起作用,所以我嘗試再次刪除、卸載/重新安裝 nodejj,現在我根本無法啟動它。

我從這里嘗試了故障排除步驟: npm ERR! 代碼生命周期

但不幸的是,他們根本沒有幫助......

我不知道是否有辦法執行全新安裝,因為它可能是保存在緩存中某處的東西(即使我完全刪除了目錄)。 我願意接受任何建議。

預先感謝您的所有回答和評論。

這是來自cli的錯誤:

C:\Users\Sergej\NewProject>npm start

> @ start C:\Users\Sergej\NewProject
> expo start

Starting project at C:\Users\Sergej\NewProject
Expo DevTools is running at http://localhost:19002
Opening DevTools in the browser... (press shift-d to disable)
error Invalid regular expression: /(.*\\__fixtures__\\.*|node_modules[\\\]react[\\\]dist[\\\].*|website\\node_modules\\.*|heapCapture\\bundle\.js|.*\\__tests__\\.*)$/: Unterminated character class. Run CLI with --verbose flag for more details.

Metro Bundler process exited with code 1
Set EXPO_DEBUG=true in your env to view the stack trace.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ start: `expo start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ start 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\Sergej\AppData\Roaming\npm-cache\_logs\2019-10-31T16_44_26_903Z-debug.log

這是日志文件文本:

0 info it worked if it ends with ok
1 verbose cli [
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'
1 verbose cli ]
2 info using npm@6.12.0
3 info using node@v12.13.0
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\Sergej\NewProject\node_modules\.bin;C:\Users\Sergej\AppData\Roaming\npm;C:\Program Files\nodejs\;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\nodejs\;C:\Users\Sergej\AppData\Local\Microsoft\WindowsApps;C:\Users\Sergej\AppData\Roaming\npm
9 verbose lifecycle @~start: CWD: C:\Users\Sergej\NewProject
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:332:16)
13 verbose stack     at EventEmitter.emit (events.js:210:5)
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:210:5)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid @
15 verbose cwd C:\Users\Sergej\NewProject
16 verbose Windows_NT 10.0.18362
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v12.13.0
19 verbose npm  v6.12.0
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 ]

因此,在花費大量時間嘗試解決問題之后(通常我發現的所有步驟都涉及以一種或另一種方式重新安裝依賴項),我找到了答案。

事實證明,最新的 node.js 問題與 Windows 有一些問題,對我來說解決這個問題的唯一方法是下載以前的版本。 我已經從以下位置下載了它:

https://nodejs.org/en/download/releases/

為我修復它的版本是 Node.js 10.x

快速無痛(幾乎)

我希望這會幫助那些遇到類似問題的人......

我有一個類似的問題,我首先嘗試了這些步驟:

rm -rf node_modules 

rm -rf package-lock.json

npm install

npm start

但沒有任何效果。

所以我在終端消息中挖掘,發現babel-eslint依賴項指向與我正在處理的項目不同的其他項目目錄,然后我去了那個方向並尋找一個node_modules文件夾,瞧! 這是關於在我當然不應該運行npm install的問題。

我的項目容器文件夾中的一個簡單的rm -rf node_modules就足以讓一切恢復正常!

我有完全相同的錯誤消息。 這可能無關緊要,但我想出了我的錯誤。 使用 VS 2019CE node.js 項目。 對我來說,我輸入了類似 debug("trying to log something to the console") 之類的東西,然后我認為這是錯誤的並添加了缺少的控制台密鑰 console.debug("bla") 然后運行它失敗了.. .問題是VS自動添加

                      import { debug } from 'webpack';

我只是將其注釋掉,然后它又開始工作了。 我將把它留給最終做同樣事情的人。

我在嘗試構建 gitlab ci 時遇到了同樣的問題,我決定定義一個CI: false環境變量,之后它工作,我不需要更改節點或 npm 版本。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM