Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js Npm安装重建。每次安装后节点gyp_Node.js_Npm_Node Gyp_Fsevents - Fatal编程技术网

Node.js Npm安装重建。每次安装后节点gyp

Node.js Npm安装重建。每次安装后节点gyp,node.js,npm,node-gyp,fsevents,Node.js,Npm,Node Gyp,Fsevents,每次安装npm时,我都会收到这条消息: > fsevents@1.2.4 install /Users/USERNAME/URL/TO/GULP/FILE/node_modules/fsevents > node install [fsevents] Success: "/Users/USERNAME/URL/TO/GULP/FILE/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" al

每次安装npm时,我都会收到这条消息:

> fsevents@1.2.4 install /Users/USERNAME/URL/TO/GULP/FILE/node_modules/fsevents
> node install

[fsevents] Success: "/Users/USERNAME/URL/TO/GULP/FILE/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile

> node-sass@3.13.1 install /Users/USERNAME/URL/TO/GULP/FILE/node_modules/node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v3.13.1/darwin-x64-57_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v3.13.1/darwin-x64-57_binding.node":

HTTP error 404 Not Found

Hint: If github.com is not accessible in your location
      try setting a proxy via HTTP_PROXY, e.g.

      export HTTP_PROXY=http://example.com:1234

or configure npm proxy via

      npm config set proxy http://example.com:8080

> node-sass@3.13.1 postinstall /Users/USERNAME/URL/TO/GULP/FILE/node_modules/node-sass
> node scripts/build.js

Building: /usr/local/bin/node /Users/USERNAME/URL/TO/GULP/FILE/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [ '/usr/local/bin/node',
gyp verb cli   '/Users/USERNAME/URL/TO/GULP/FILE/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library=' ]
gyp info using node-gyp@3.7.0
gyp info using node@8.11.1 | darwin | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed     at getNotFoundError (/Users/USERNAME/URL/TO/GULP/FILE/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/Users/USERNAME/URL/TO/GULP/FILE/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/Users/USERNAME/URL/TO/GULP/FILE/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /Users/USERNAME/URL/TO/GULP/FILE/node_modules/which/which.js:89:16
gyp verb `which` failed     at /Users/USERNAME/URL/TO/GULP/FILE/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /Users/USERNAME/URL/TO/GULP/FILE/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:152:21)
gyp verb `which` failed  python2 { Error: not found: python2
gyp verb `which` failed     at getNotFoundError (/Users/USERNAME/URL/TO/GULP/FILE/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/Users/USERNAME/URL/TO/GULP/FILE/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/Users/USERNAME/URL/TO/GULP/FILE/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /Users/USERNAME/URL/TO/GULP/FILE/node_modules/which/which.js:89:16
gyp verb `which` failed     at /Users/USERNAME/URL/TO/GULP/FILE/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /Users/USERNAME/URL/TO/GULP/FILE/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:152:21)
gyp verb `which` failed   stack: 'Error: not found: python2\n    at getNotFoundError (/Users/USERNAME/URL/TO/GULP/FILE/node_modules/which/which.js:13:12)\n    at F (/Users/USERNAME/URL/TO/GULP/FILE/node_modules/which/which.js:68:19)\n    at E (/Users/USERNAME/URL/TO/GULP/FILE/node_modules/    which/which.js:80:29)\n    at /Users/USERNAME/URL/TO/GULP/FILE/node_modules/which/which.js:89:16\n    at /Users/USERNAME/URL/TO/GULP/FILE/node_modules/isexe/index.js:42:5\n    at /Users/USERNAME/URL/TO/GULP/FILE/node_modules/isexe/mode.js:8:5\n    at FSReqWrap.oncomplete (fs.js:152:21)',
gyp verb `which` failed   code: 'ENOENT' }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python /usr/bin/python
gyp verb check python version `/usr/bin/python -c "import platform; print(platform.python_version());"` returned: "2.7.10\n"
gyp verb get node dir no --target version specified, falling back to host node version: 8.11.1
gyp verb command install [ '8.11.1' ]
gyp verb install input version string "8.11.1"
gyp verb install installing version: 8.11.1
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 8.11.1
gyp verb build dir attempting to create "build" dir: /Users/USERNAME/URL/TO/GULP/FILE/node_modules/node-sass/build
gyp verb build dir "build" dir needed to be created? /Users/USERNAME/URL/TO/GULP/FILE/node_modules/node-sass/build
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: /Users/USERNAME/URL/TO/GULP/FILE/node_modules/node-sass/build/config.gypi
gyp verb config.gypi checking for gypi file: /Users/USERNAME/URL/TO/GULP/FILE/node_modules/node-sass/config.gypi
gyp verb common.gypi checking for gypi file: /Users/USERNAME/URL/TO/GULP/FILE/node_modules/node-sass/common.gypi
gyp verb gyp gyp format was not specified; forcing "make"
gyp info spawn /usr/bin/python
gyp info spawn args [ '/Users/USERNAME/URL/TO/GULP/FILE/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/USERNAME/URL/TO/GULP/FILE/node_modules/node-sass/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/USERNAME/URL/TO/GULP/FILE/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/USERNAME/.node-gyp/8.11.1/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/USERNAME/.node-gyp/8.11.1',
gyp info spawn args   '-Dnode_gyp_dir=/Users/USERNAME/URL/TO/GULP/FILE/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/USERNAME/.node-gyp/8.11.1/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/USERNAME/URL/TO/GULP/FILE/node_modules/node-sass',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp verb command build []
gyp verb build type Release
gyp verb architecture x64
gyp verb node dev dir /Users/USERNAME/.node-gyp/8.11.1
gyp verb `which` succeeded for `make` /usr/bin/make
gyp info spawn make
gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ]
  c++ '-DNODE_GYP_MODULE_NAME=libsass' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DLIBSASS_VERSION="3.3.6"' -I/Users/USERNAME/.node-gyp/8.11.1/include/node -I/Users/    USERNAME/.node-gyp/8.11.1/src -I/Users/USERNAME/.node-gyp/8.11.1/deps/openssl/config -I/Users/USERNAME/.node-gyp/8.11.1/deps/openssl/openssl/include -I/Users/USERNAME/.node-gyp/8.11.1/deps/uv/include -I/Users/USERNAME/.node-gyp/8.11.1/deps/zlib -I/Users/USERNAME/.node-gyp/8.11.1/deps/    v8/include -I../src/libsass/include  -Os -gdwarf-2 -mmacosx-version-min=10.7 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -std=c++11 -stdlib=libc++ -fno-threadsafe-statics -fno-strict-aliasing -MMD -MF ./Release/.deps/Release/obj.target/libsass/src/libsass/src/ast.o.d.raw       -c -o Release/obj.target/libsass/src/libsass/src/ast.o ../src/libsass/src/ast.cpp
^Cmake: *** Deleting file `Release/obj.target/libsass/src/libsass/src/ast.o'
make: *** [Release/obj.target/libsass/src/libsass/src/ast.o] Interrupt: 2
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN GulpFileName@1.0.0 No description
npm WARN GulpFileName@1.0.0 No repository field.    
当我使用此
package.json
-文件运行
npm install
时,会出现错误:

{
    "name": "GulpName",
    "author": "Johnny Bravo",
    "version": "1.0.0",
    "license": "GPL-2.0",
    "dependencies": {},
    "devDependencies": {
        "autoprefixer": "^8.6.3",
        "browserslist": "^3.2.8",
        "gulp": "^4.0.0",
        "gulp-concat": "^2.6.1",
        "gulp-postcss": "^7.0.1",
        "gulp-sass": "^2.0.0",
        "gulp-clean-css": "^3.9.4",
        "gulp-uglify": "^3.0.0"
    },
    "browserslist": [
        "last 2 version",
        "> 1%",
        "safari >= 5",
        "ie >= 8",
        "chrome >= 34",
        "ie_mob >= 10",
        "opera >= 23",
        "ios >= 7",
        "ff >= 7",
        "android >= 4",
        "bb >= 10"
    ]
}
我的尝试:
  • 我尝试删除
    ~/.node gyp
    (然后用
    npm cache verify
    刷新缓存)
  • 我尝试卸载所有我能看到的使用
    npm-gls--depth=0的“随机”软件包。我有一些
    phantomjs
    httpserver
    之类的东西
  • 我尝试在全局范围内安装
    node gyp
    fsevents
    node sass
    ,希望不必在安装过程中执行这些步骤。但我仍然得到相同的长错误
。。。显然,在解决这个问题的整个过程中,我使用了
rm-rf node_modules package lock.json
,然后是
npm install
无数次

我明白了,有些人会犯类似的错误,这是由于一些虚构的东西。我从来没有用过这样的东西


每次运行
npm install

好吧,我真的要忍受这个冗长乏味的安装过程吗。。。大部分是我自己想的。问题是
节点sass
的版本
“~2.0.0”
,太旧了。当我将其提升到
“4.0.1”
时,
节点gyp
的重新编译就消失了

不过,这是我的过程——对于那些想自己尝试一些东西的新手来说:

  • 请记住,您有本地包(在
    package.json
    中)和全局包(通过编写访问:
    npm-gls--depth=0

  • 您可以通过以下方式删除所有全局包

  • 然后一次删除一个devdependency,然后尝试运行
    npm install
    ,直到愚蠢的错误消失

  • 我仍然会遇到这个错误(我不会解决这个问题,因为我将我的
    npm安装时间减少了一分钟左右,这对我来说已经足够了)

    {
        "name": "GulpName",
        "author": "Johnny Bravo",
        "version": "1.0.0",
        "license": "GPL-2.0",
        "dependencies": {},
        "devDependencies": {
            "autoprefixer": "^8.6.3",
            "browserslist": "^3.2.8",
            "gulp": "^4.0.0",
            "gulp-concat": "^2.6.1",
            "gulp-postcss": "^7.0.1",
            "gulp-sass": "^2.0.0",
            "gulp-clean-css": "^3.9.4",
            "gulp-uglify": "^3.0.0"
        },
        "browserslist": [
            "last 2 version",
            "> 1%",
            "safari >= 5",
            "ie >= 8",
            "chrome >= 34",
            "ie_mob >= 10",
            "opera >= 23",
            "ios >= 7",
            "ff >= 7",
            "android >= 4",
            "bb >= 10"
        ]
    }
    
    > fsevents@1.2.4 install /PATH/TO/PACKAGEJSON-FILE/node_modules/fsevents
    > node install
    
    [fsevents] Success: "/PATH/TO/PACKAGEJSON-FILE/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" already installed
    Pass --update-binary to reinstall or --build-from-source to recompile
    
    > node-sass@4.9.0 install /PATH/TO/PACKAGEJSON-FILE/node_modules/node-sass
    > node scripts/install.js
    
    Cached binary found at /Users/REDACTED/.npm/node-sass/4.9.0/darwin-x64-57_binding.node
    
    > node-sass@4.9.0 postinstall /PATH/TO/PACKAGEJSON-FILE/node_modules/node-sass
    > node scripts/build.js
    
    Binary found at /PATH/TO/PACKAGEJSON-FILE/node_modules/node-sass/vendor/darwin-x64-57/binding.node
    Testing binary
    Binary is fine