簡體   English   中英

無法創建新的Ionic 3項目npm ERR! 代碼ELIFECYCLE npm ERR! errno 1 npm錯誤! node-sass@4.5.3安裝后:`node scripts / build.js`

[英]Unable to create a new Ionic 3 project npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! node-sass@4.5.3 postinstall: `node scripts/build.js`

我在Ionic 3中嘗試創建新項目的日子不好過。我有以下版本:

  1. 離子3.9.2
  2. npm 6.7.0
  3. 節點v8.10.0

我正在使用Ubuntu 18,每次都執行以下操作:

sudo ionic start test blank

我收到此消息:

        https://nodejs.org/download/release/v8.10.0/node-v8.10.0-headers.tar.gz
        gyp WARN install got an error, rolling back install
        gyp verb command remove [ '8.10.0' ]
        gyp verb remove using node-gyp dir: /home/abraham/.node-gyp
        gyp verb remove removing target version: 8.10.0
        gyp verb remove removing development files for version: 8.10.0
        gyp ERR! configure error 
        gyp ERR! stack Error: ENOENT: no such file or directory, open 
        '/home/abraham/='
        gyp ERR! stack     at Object.fs.openSync (fs.js:646:18)
        gyp ERR! stack     at Object.fs.readFileSync (fs.js:551:33)
        gyp ERR! stack     at readCAFile 
        (/home/abraham/Documentos/Ionic/IonicCurso/prueba/prueba/node_modules/node-gyp/lib/install.js:472:15)
        gyp ERR! stack     at download 
        (/home/abraham/Documentos/Ionic/IonicCurso/prueba/prueba/node_modules/node-gyp/lib/install.js:444:22)
        gyp ERR! stack     at 
        /home/abraham/Documentos/Ionic/IonicCurso/prueba/prueba/node_modules/node-gyp/lib/install.js:189:19
        gyp ERR! stack     at 
        /home/abraham/Documentos/Ionic/IonicCurso/prueba/prueba/node_modules/mkdirp/index.js:48:26
        gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:153:5)
        gyp ERR! System Linux 4.15.0-43-generic
        gyp ERR! command "/usr/bin/node" 
        "/home/abraham/Documentos/Ionic/IonicCurso/prueba/prueba/node_modules/node-gyp/bin/node-gyp.js" 
        "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" 
        "--libsass_ldflags=" "--libsass_library="
        gyp ERR! cwd 
        /home/abraham/Documentos/Ionic/IonicCurso/prueba/prueba/node_modules/node-sass
        gyp ERR! node -v v8.10.0
        gyp ERR! node-gyp -v v3.8.0
        gyp ERR! not ok 
        Build failed with error code: 1
        npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 
        (node_modules/fsevents):
        npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for 
        fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: 
        {"os":"linux","arch":"x64"})

        npm ERR! code ELIFECYCLE
        npm ERR! errno 1
        npm ERR! node-sass@4.5.3 postinstall: `node scripts/build.js`
        npm ERR! Exit status 1
        npm ERR! 
        npm ERR! Failed at the node-sass@4.5.3 postinstall 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!     /home/abraham/.npm/_logs/2019-01-26T16_26_10_675Z-debug.log

我已經嘗試過了,但我不知道是否需要重新安裝離子泵:

npm rebuild node-sass

謝謝您的幫助

有時候,您不想更改npm使用的默認目錄的所有權(例如/ usr),因為這可能會引起一些問題,例如,如果您要與其他用戶共享系統。

相反,您可以將npm配置為完全使用其他目錄。 在我們的情況下,這將是我們主文件夾中的隱藏目錄。

創建用於全局安裝的目錄:

mkdir ~/.npm-global

配置npm以使用新的目錄路徑:

npm config set prefix '~/.npm-global'

打開或創建〜/ .profile文件並添加以下行:

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

返回命令行,更新系統變量:

source ~/.profile

暫無
暫無

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

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