【发布时间】:2022-01-11 16:43:04
【问题描述】:
我不知道为什么会出现这个错误以及如何解决它 当我尝试更新模块时,我会再次看到同样的错误
我尝试更新核心 js。 我使用了这些命令 npm 已过时 npm 安装 npm 安装
我也尝试遵循该指南 npm WARN old lockfile The package-lock.json file was created with an old version of npm
但没有任何帮助 可以吗?
npm WARN ancient lockfile
npm WARN ancient lockfile The npm-shrinkwrap.json file was created with an old version of npm,
npm WARN ancient lockfile so supplemental metadata must be fetched from the registry.
npm WARN ancient lockfile
npm WARN ancient lockfile This is a one-time fix-up, please be patient...
npm WARN ancient lockfile
npm WARN deprecated natives@1.1.6: This module relies on Node.js's internals and will break at some point. Do not use it, and update to graceful-fs@4.x.
npm WARN deprecated source-map-url@0.4.1: See https://github. com/lydell/source-map-url#deprecated
npm WARN deprecated babel-preset-es2015@6.24.1: ???? Thanks for using Babel: we recommend using babel-preset-env now: please read https://babeljs. io/env to update!
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated urix@0.1.0: Please see https://github. com/lydell/urix#deprecated
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated resolve-url@0.2.1: https://github. com/lydell/resolve-url#deprecated
npm WARN deprecated graceful-fs@1.2.3: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated source-map-resolve@0.5.3: See https://github. com/lydell/source-map-resolve#deprecated
npm WARN deprecated fs-promise@0.5.0: Use mz or fs-extra^3.0 with Promise Support
npm WARN deprecated gulp-util@3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium. com/gulpjs/gulp-util-ca3b1f9f9ac5
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github .com/visionmedia/debug/issues/797)
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github .com/visionmedia/debug/issues/797)
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github .com/visionmedia/debug/issues/797)
npm WARN deprecated uuid@2.0.3: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8 .dev/blog/math-random for details.
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8 .dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github .com/request/request/issues/3142
npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm WARN deprecated core-js@2.6.12: core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated core-js@2.6.12: core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! code 1
npm ERR! path /Users/user/projects/proj_local/web/themes/custom/site/node_modules/node-sass
npm ERR! command failed
npm ERR! command sh -c node scripts/build.js
npm ERR! Building: /opt/homebrew/Cellar/node/16.4.0/bin/node /Users/user/projects/proj_local/web/themes/custom/site/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli '/opt/homebrew/Cellar/node/16.4.0/bin/node',
npm ERR! gyp verb cli '/Users/user/projects/proj_local/web/themes/custom/site/node_modules/node-gyp/bin/node-gyp.js',
npm ERR! gyp verb cli 'rebuild',
npm ERR! gyp verb cli '--verbose',
npm ERR! gyp verb cli '--libsass_ext=',
npm ERR! gyp verb cli '--libsass_cflags=',
npm ERR! gyp verb cli '--libsass_ldflags=',
npm ERR! gyp verb cli '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@16.4.0 | darwin | arm64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb `which` succeeded python2 /usr/bin/python2
npm ERR! gyp verb check python version `/usr/bin/python2 -c "import sys; print "2.7.16
npm ERR! gyp verb check python version .%s.%s" % sys.version_info[:3];"` returned: %j
npm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 16.4.0
npm ERR! gyp verb command install [ '16.4.0' ]
npm ERR! gyp verb install input version string "16.4.0"
npm ERR! gyp verb install installing version: 16.4.0
npm ERR! gyp verb install --ensure was passed, so won't reinstall if already installed
npm ERR! gyp verb install version is already installed, need to check "installVersion"
npm ERR! gyp verb got "installVersion" 9
npm ERR! gyp verb needs "installVersion" 9
npm ERR! gyp verb install version is good
npm ERR! gyp verb get node dir target node version installed: 16.4.0
npm ERR! gyp verb build dir attempting to create "build" dir: /Users/user/projects/proj_local/web/themes/custom/site/node_modules/node-sass/build
npm ERR! gyp verb build dir "build" dir needed to be created? /Users/user/projects/proj_local/web/themes/custom/site/node_modules/node-sass/build
npm ERR! gyp verb build/config.gypi creating config file
npm ERR! gyp verb build/config.gypi writing out config file: /Users/user/projects/proj_local/web/themes/custom/site/node_modules/node-sass/build/config.gypi
npm ERR! (node:65143) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! gyp verb config.gypi checking for gypi file: /Users/user/projects/proj_local/web/themes/custom/site/node_modules/node-sass/config.gypi
npm ERR! gyp verb common.gypi checking for gypi file: /Users/user/projects/proj_local/web/themes/custom/site/node_modules/node-sass/common.gypi
npm ERR! gyp verb gyp gyp format was not specified; forcing "make"
npm ERR! gyp info spawn /usr/bin/python2
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/Users/user/projects/proj_local/web/themes/custom/site/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/user/projects/proj_local/web/themes/custom/site/node_modules/node-sass/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/user/projects/proj_local/web/themes/custom/site/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/user/.node-gyp/16.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/user/.node-gyp/16.4.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/Users/user/projects/proj_local/web/themes/custom/site/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/user/.node-gyp/16.4.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/user/projects/proj_local/web/themes/custom/site/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! No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
npm ERR!
npm ERR! No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.
npm ERR!
npm ERR! No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.
npm ERR!
npm ERR! gyp: No Xcode or CLT version detected!
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onCpExit (/Users/user/projects/proj_local/web/themes/custom/site/node_modules/node-gyp/lib/configure.js:345:16)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:394:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Darwin 20.6.0
npm ERR! gyp ERR! command "/opt/homebrew/Cellar/node/16.4.0/bin/node" "/Users/user/projects/proj_local/web/themes/custom/site/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd /Users/user/projects/proj_local/web/themes/custom/site/node_modules/node-sass
npm ERR! gyp ERR! node -v v16.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:
npm ERR! /Users/user/.npm/_logs/2022-01-11T08_07_04_422Z-debug.log
This is my GULP
// Configurations
let config = {
settings: require('./src/compile-settings.json')
};
// Output the error to the terminal instead of dying out
function swallowError(error) {
// If you want details of the error in the console
console.log(error.toString());
this.emit('end');
}
// Load plugins
const gulp = require('gulp');
const bless = require('gulp-bless');
const babel = require('gulp-babel');
const styles = require('gulp-sass');
const del = require('del');
const modernizr = require('gulp-modernizr');
const autoprefixer = require('gulp-autoprefixer');
const imagemin = require('gulp-imagemin');
const concat = require('gulp-concat');
const browserSync = require('browser-sync').create();
const sourcemaps = require('gulp-sourcemaps');
const runSequence = require('run-sequence');
// Builders
gulp.task('build:modernizr', (callback) => {
runSequence(['build:styles'], 'clean:modernizr', 'process:modernizr', callback);
});
gulp.task('build:styles', (callback) => {
runSequence('clean:styles', 'process:styles_site', callback);
});
//gulp.task('build:javascripts', (callback) => {
// runSequence('clean:javascripts', 'process:javascripts', callback);
//});
//gulp.task('build:fonts', (callback) => {
// runSequence('clean:fonts', 'process:fonts', callback);
//});
//gulp.task('build:images', (callback) => {
// runSequence('clean:images', 'process:images', callback);
//});
// Processors
gulp.task('process:modernizr', () => {
return gulp.src(['dist/stylesheets/*.css', '!dist/javascripts/modernizr.js'])
.pipe(modernizr({
'cache': true,
'uglify': true,
'options': [
'setClasses',
'addTest',
'html5printshiv',
'testProp',
'fnBind'
],
excludeTests: [
'hidden'
]
}))
});
gulp.task('process:styles_site', () => {
return gulp.src(config.settings.styles_site)
.pipe(sourcemaps.init())
.pipe(styles().on('error', swallowError))
.pipe(autoprefixer('last 2 version'))
.pipe(bless())
.pipe(sourcemaps.write())
.pipe(gulp.dest('dist/stylesheets'))
.pipe(browserSync.stream({match: '**/*.css'}));
});
//gulp.task('process:javascripts', () => {
// return gulp.src(config.settings.javascripts)
// .on('error', swallowError)
// .pipe(sourcemaps.init())
// .pipe(babel({
// presets: ['env']
// }))
// .pipe(concat('app.js'))
// .pipe(sourcemaps.write())
// .pipe(gulp.dest('dist/javascripts'));
//});
//gulp.task('process:fonts', () => {
// return gulp.src(config.settings.fonts)
// .pipe(gulp.dest('dist/fonts'));
//});
//gulp.task('process:images', () => {
// return gulp.src('src/images/**/*.+(png|jpg|gif|svg)')
// .pipe(
// imagemin({
// optimizationLevel: 5,
// progressive: true,
// interlaced: true
// })
// )
// .pipe(gulp.dest('dist/images'));
//});
// Cleaners
gulp.task('clean:modernizr', () => {
return del(['dist/javascripts/modernizr.js']);
});
gulp.task('clean:styles', () => {
return del(['dist/stylesheets']);
});
gulp.task('clean:javascripts', () => {
return del(['dist/javascripts/*.js', '!dist/javascripts/modernizr.js']);
});
//gulp.task('clean:images', () => {
// return del(['dist/images']);
//});
//gulp.task('clean:fonts', () => {
// return del(['dist/fonts']);
//});
// Reloaders
gulp.task('reload:javascripts', () => {
return browserSync.reload();
});
//gulp.task('reload:fonts', () => {
// return browserSync.reload();
//});
//gulp.task('reload:images', () => {
// return browserSync.reload();
//});
gulp.task('reload:template', () => {
return browserSync.reload();
});
// Watchers
gulp.task('watcher:styles', (callback) => {
runSequence('build:styles', callback);
});
gulp.task('watcher:javascripts', (callback) => {
runSequence('build:javascripts', 'reload:javascripts', callback);
});
//gulp.task('watcher:fonts', (callback) => {
// runSequence('build:fonts', 'reload:fonts', callback);
//});
//gulp.task('watcher:images', (callback) => {
// runSequence('build:images', 'reload:images', callback);
//});
gulp.task('watcher:templates', (callback) => {
runSequence('reload:template', callback);
});
// Tasks
gulp.task('default', (callback) => {
runSequence('build', 'watch', callback);
});
gulp.task('watch', ['build'], () => {
gulp.watch('src/styles/**/*.scss', ['watcher:styles']);
gulp.watch('src/javascripts/**/*.js', ['watcher:javascripts']);
//gulp.watch('src/fonts/**/*.+(eot|svg|ttf|woff|woff2)', ['watcher:fonts']);
//gulp.watch('src/images/**/*.+(png|jpg|gif|svg)', ['watcher:images']);
gulp.watch('**/*.+(twig|twig.html|tpl|tpl.php|html)', ['watcher:templates']);
// Browser sync
browserSync.init(['dist/stylesheets/*.css', 'dist/javascripts/*.js'], {
// proxy: config.settings.options.proxy
});
});
gulp.task('build', (callback) => {
runSequence(['build:modernizr'], callback);
});
THIS IS package.json
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development gulp build",
"watch": "cross-env NODE_ENV=development gulp watch",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production",
"preshrinkwrap": "git checkout -- npm-shrinkwrap.json",
"postshrinkwrap": "git checkout -- npm-shrinkwrap.json"
},
"dependencies": {
"additional-bootstrap-colors": "^1.0.5",
"angled-edges": "^2.0.0",
"babel-preset-es2015": "^6.24.1",
"bootstrap-chosen": "^1.4.2",
"bootstrap-sass": "^3.3.7",
"boxy-concept": "^1.0.1",
"column-restrictor": "^1.0.1",
"content-transitions": "^1.0.4",
"element-wrapper-link": "^1.0.0",
"js-cookie": "^2.2.0",
"readable-bootstrap-breakpoints": "^1.0.2",
"responsive-utilities": "^1.0.2",
"sectioned": "^1.0.7",
"typography-breakpoints-justification": "^1.0.0",
"typography-helper": "^1.0.5",
"slinky-bootstrap-theme": "^1.0.2"
},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babel-preset-es2015-rollup": "^3.0.0",
"browser-sync": "^2.26.7",
"cross-env": "^5.1.3",
"del": "^3.0.0",
"gulp": "^3.9.1",
"gulp-autoprefixer": "^5.0.0",
"gulp-babel": "^7.0.0",
"gulp-bless": "^4.0.0",
"gulp-concat": "^2.6.1",
"gulp-debug": "^3.2.0",
"gulp-imagemin": "^4.1.0",
"gulp-modernizr": "^2.0.0",
"gulp-sass": "^4.0.1",
"gulp-sourcemaps": "^2.6.1",
"run-sequence": "^2.2.1"
}
}
【问题讨论】:
-
这是不是 Gulp 错误。这是您的
node-gyp设置(或环境)错误。 -
好的,谢谢 我应该以某种方式更新 node-gyp 吗?
-
阅读下面我的答案并参考
node-gypdocs ⬇ :D
标签: javascript npm gulp npm-install