我试图构建一个旧的应用程序angular/ionic,但似乎只在node-gyp sass命令上失败。我该怎么办?
下面是package.json:
{
"name": "ccc",
"version": "1.0.0",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"preinstall": "export SASS_BINARY_SITE=http://local.com:8081/repository/npm-local/sass/node-sass/releases/download",
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build browser",
"copy": "ionic-app-scripts copy",
"ionic:build": "ionic-app-scripts build --prod",
"ionic:serve": "concurrently --kill-others \"ionic-app-scripts serve --nobrowser\" ",
"package": "ionic-app-scripts build --minifycss browser"
},
"dependencies": {
"@angular/animations": "5.2.10",
"@angular/common": "5.2.10",
"@angular/compiler": "5.2.10",
"@angular/compiler-cli": "5.2.10",
"@angular/core": "5.2.10",
"@angular/forms": "5.2.10",
"@angular/http": "5.2.10",
"@angular/platform-browser": "5.2.10",
"@angular/platform-browser-dynamic": "5.2.10",
"@ionic-native/core": "4.7.0",
"@ionic-native/splash-screen": "4.7.0",
"@ionic-native/status-bar": "4.7.0",
"@ionic/storage": "2.1.3",
"intl": "^1.2.5",
"ionic-angular": "3.9.2",
"ionicons": "3.0.0",
"moment": "2.21.0",
"rxjs": "5.5.10",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.26"
},
"devDependencies": {
"@ionic/app-scripts": "3.1.9",
"@types/jasmine": "2.8.7",
"@types/node": "7.0.15",
"angular2-template-loader": "0.6.2",
"awesome-typescript-loader": "3.1.3",
"codelyzer": "4.3.0",
"concurrently": "^3.4.0",
"html-loader": "^0.4.5",
"istanbul-instrumenter-loader": "^2.0.0",
"jasmine-core": "^2.6.1",
"jasmine-spec-reporter": "^4.1.0",
"karma": "^1.6.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "1.0.1",
"karma-coverage": "^1.1.1",
"karma-firefox-launcher": "^1.0.1",
"karma-jasmine": "^1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-mocha-reporter": "^2.2.3",
"karma-remap-coverage": "^0.1.4",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^2.0.3",
"null-loader": "^0.1.1",
"raw-loader": "^0.5.1",
"source-map-loader": "^0.2.1",
"ts-helpers": "^1.1.2",
"ts-loader": "4.2.0",
"ts-node": "6.0.1",
"tslint": "5.9.1",
"tslint-loader": "3.6.0",
"typescript": "2.7.2"
},
"engines": {
"node": ">= 6.0.0",
"npm": ">= 3"
},
"config": {
"ionic_copy": "./config/copy.js"
},
"cordova": {
"plugins": {
"cordova-plugin-advanced-http": {}
}
}
}
使用当前构建系统:
npm -版本8.3.1
节点--版本v17.4.0
npm安装--强制--旧对等部署--不安全权限
此处为错误
npm ERR! gyp info spawn /usr/bin/python2
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/Users/SomeUser/git-main5/ccc/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/SomeUser/git-main5/ccc/node_modules/node-sass/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/SomeUser/git-main5/ccc/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/SomeUser/.node-gyp/17.4.0/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/Users/SomeUser/.node-gyp/17.4.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/Users/SomeUser/git-main5/ccc/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/SomeUser/.node-gyp/17.4.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/SomeUser/git-main5/ccc/node_modules/node-sass',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp verb command build []
npm ERR! gyp verb build type Release
npm ERR! gyp verb architecture x64
npm ERR! gyp verb node dev dir /Users/SomeUser/.node-gyp/17.4.0
npm ERR! gyp verb `which` succeeded for `make` /usr/bin/make
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! In file included from ../src/binding.cpp:1:
npm ERR! In file included from ../../nan/nan.h:60:
npm ERR! In file included from /Users/SomeUser/.node-gyp/17.4.0/include/node/node.h:63:
npm ERR! In file included from /Users/SomeUser/.node-gyp/17.4.0/include/node/v8.h:25:
npm ERR! In file included from /Users/SomeUser/.node-gyp/17.4.0/include/node/v8-array-buffer.h:12:
npm ERR! In file included from /Users/SomeUser/.node-gyp/17.4.0/include/node/v8-local-handle.h:12:
npm ERR! /Users/SomeUser/.node-gyp/17.4.0/include/node/v8-internal.h:563:38: error: no template named 'remove_cv_t' in namespace 'std'; did you mean 'remove_cv'?
npm ERR! !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
npm ERR! ~~~~~^~~~~~~~~~~
npm ERR! remove_cv
npm ERR! /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/type_traits:660:50: note: 'remove_cv' declared here
npm ERR! template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_cv
npm ERR! ^
npm ERR! ../src/binding.cpp:248:30: warning: 'Call' is deprecated [-Wdeprecated-declarations]
npm ERR! ctx_w->success_callback->Call(0, 0);
npm ERR! ^
npm ERR! ../../nan/nan.h:1745:3: note: 'Call' has been explicitly marked deprecated here
npm ERR! NAN_DEPRECATED inline v8::Local<v8::Value>
npm ERR! ^
npm ERR! ../../nan/nan.h:110:40: note: expanded from macro 'NAN_DEPRECATED'
npm ERR! # define NAN_DEPRECATED __attribute__((deprecated))
npm ERR! ^
npm ERR! ../src/binding.cpp:256:28: warning: 'Call' is deprecated [-Wdeprecated-declarations]
npm ERR! ctx_w->error_callback->Call(1, argv);
npm ERR! ^
npm ERR! ../../nan/nan.h:1745:3: note: 'Call' has been explicitly marked deprecated here
npm ERR! NAN_DEPRECATED inline v8::Local<v8::Value>
npm ERR! ^
npm ERR! ../../nan/nan.h:110:40: note: expanded from macro 'NAN_DEPRECATED'
npm ERR! # define NAN_DEPRECATED __attribute__((deprecated))
npm ERR! ^
npm ERR! In file included from ../src/binding.cpp:3:
npm ERR! In file included from ../src/sass_context_wrapper.h:9:
npm ERR! In file included from ../src/custom_function_bridge.h:7:
npm ERR! ../src/callback_bridge.h:162:21: warning: 'Call' is deprecated [-Wdeprecated-declarations]
npm ERR! bridge->callback->Call(argv_v8.size(), &argv_v8[0]);
npm ERR! ^
npm ERR! ../src/callback_bridge.h:68:65: note: in instantiation of member function 'CallbackBridge<Sass_Value *, void *>::dispatched_async_uv_callback' requested here
npm ERR! uv_async_init(uv_default_loop(), this->async, (uv_async_cb) dispatched_async_uv_callback);
npm ERR! ^
npm ERR! ../src/custom_function_bridge.h:11:70: note: in instantiation of member function 'CallbackBridge<Sass_Value *, void *>::CallbackBridge' requested here
npm ERR! CustomFunctionBridge(v8::Local<v8::Function> cb, bool is_sync) : CallbackBridge<Sass_Value*>(cb, is_sync) {}
npm ERR! ^
npm ERR! ../../nan/nan.h:1745:3: note: 'Call' has been explicitly marked deprecated here
npm ERR! NAN_DEPRECATED inline v8::Local<v8::Value>
npm ERR! ^
npm ERR! ../../nan/nan.h:110:40: note: expanded from macro 'NAN_DEPRECATED'
npm ERR! # define NAN_DEPRECATED __attribute__((deprecated))
npm ERR! ^
npm ERR! In file included from ../src/binding.cpp:3:
npm ERR! In file included from ../src/sass_context_wrapper.h:9:
npm ERR! In file included from ../src/custom_function_bridge.h:7:
npm ERR! ../src/callback_bridge.h:162:21: warning: 'Call' is deprecated [-Wdeprecated-declarations]
npm ERR! bridge->callback->Call(argv_v8.size(), &argv_v8[0]);
npm ERR! ^
npm ERR! ../src/callback_bridge.h:68:65: note: in instantiation of member function 'CallbackBridge<Sass_Import **, void *>::dispatched_async_uv_callback' requested here
npm ERR! uv_async_init(uv_default_loop(), this->async, (uv_async_cb) dispatched_async_uv_callback);
npm ERR! ^
npm ERR! ../src/custom_importer_bridge.h:13:70: note: in instantiation of member function 'CallbackBridge<Sass_Import **, void *>::CallbackBridge' requested here
npm ERR! CustomImporterBridge(v8::Local<v8::Function> cb, bool is_sync) : CallbackBridge<SassImportList>(cb, is_sync) {}
npm ERR! ^
npm ERR! ../../nan/nan.h:1745:3: note: 'Call' has been explicitly marked deprecated here
npm ERR! NAN_DEPRECATED inline v8::Local<v8::Value>
npm ERR! ^
npm ERR! ../../nan/nan.h:110:40: note: expanded from macro 'NAN_DEPRECATED'
npm ERR! # define NAN_DEPRECATED __attribute__((deprecated))
npm ERR! ^
npm ERR! In file included from ../src/binding.cpp:3:
npm ERR! In file included from ../src/sass_context_wrapper.h:9:
npm ERR! In file included from ../src/custom_function_bridge.h:7:
npm ERR! ../src/callback_bridge.h:110:23: warning: 'Call' is deprecated [-Wdeprecated-declarations]
npm ERR! this->callback->Call(argv_v8.size(), &argv_v8[0])
npm ERR! ^
npm ERR! ../src/binding.cpp:19:16: note: in instantiation of member function 'CallbackBridge<Sass_Import **, void *>::operator()' requested here
npm ERR! return bridge(argv);
npm ERR! ^
npm ERR! ../../nan/nan.h:1745:3: note: 'Call' has been explicitly marked deprecated here
npm ERR! NAN_DEPRECATED inline v8::Local<v8::Value>
npm ERR! ^
npm ERR! ../../nan/nan.h:110:40: note: expanded from macro 'NAN_DEPRECATED'
npm ERR! # define NAN_DEPRECATED __attribute__((deprecated))
npm ERR! ^
npm ERR! In file included from ../src/binding.cpp:3:
npm ERR! In file included from ../src/sass_context_wrapper.h:9:
npm ERR! In file included from ../src/custom_function_bridge.h:7:
npm ERR! ../src/callback_bridge.h:110:23: warning: 'Call' is deprecated [-Wdeprecated-declarations]
npm ERR! this->callback->Call(argv_v8.size(), &argv_v8[0])
npm ERR! ^
npm ERR! ../src/binding.cpp:32:16: note: in instantiation of member function 'CallbackBridge<Sass_Value *, void *>::operator()' requested here
npm ERR! return bridge(argv);
npm ERR! ^
npm ERR! ../../nan/nan.h:1745:3: note: 'Call' has been explicitly marked deprecated here
npm ERR! NAN_DEPRECATED inline v8::Local<v8::Value>
npm ERR! ^
npm ERR! ../../nan/nan.h:110:40: note: expanded from macro 'NAN_DEPRECATED'
npm ERR! # define NAN_DEPRECATED __attribute__((deprecated))
npm ERR! ^
npm ERR! 6 warnings and 1 error generated.
npm ERR! make: *** [Release/obj.target/binding/src/binding.o] Error 1
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack at ChildProcess.onExit (/Users/SomeUser/git-main5/ccc/node_modules/node-gyp/lib/build.js:262:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:520:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Darwin 19.6.0
npm ERR! gyp ERR! command "/usr/local/bin/node" "/Users/SomeUser/git-main5/ccc/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd /Users/SomeUser/git-main5/ccc/node_modules/node-sass
npm ERR! gyp ERR! node -v v17.4.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1
npm ERR! A complete log of this run can be found in:
2条答案
按热度按时间8iwquhpp1#
I had similiar problems with node-gyp and sass using nodeJS v17.xx. What worked for me was downgrading to nodeJS v16.17. In your case and according to the link in @MikeOne 's comment you might need to downgrade even further.
I am using linux so I will link for linux how to install nodeJS. other OS solutions can be found easily.
install nodeJS in ubuntu:
install nodeJS in ArchLinux: https://wiki.archlinux.org/title/Node.js#Installation
as I saw in one of your comments you are using macOS, I found this question on how to install nodeJS in macOS: What is the recommended way to install Node.js, nvm and npm on MacOS X?
you can then confirm your node version with:
9rygscc12#
我在node-gyp和sass上也遇到过类似的问题
以下是我的解决方案
1.将节点版本降级到v14.xX或
1.安装python2 https://www.python.org/download/releases/2.0/和env变量或
1.删除node-sass包