问题标签 [npm-debug]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
34 浏览

node.js - npm-debug 模块:如何以编程方式启用和禁用调试目标?

在Visionmedia 的Node.js 模块的文档debug中,我看到可以以编程方式启用和禁用不同的调试目标。

我这样做的尝试并不是很成功。

我创建了一个准系统脚本:test.js

当我使用 运行脚本时node test.js,我得到以下输出,这表明debug.enable("test")它既没有启用test调试目标,也没有返回任何命名空间:

当我使用 运行脚本时DEBUG=test node test.js,我得到以下输出,这表明debug.disable("test")它既没有禁用test调试目标,也没有返回任何禁用的命名空间的名称:

但是,如果我在使用ortest取消注释重新创建调试目标的行,那么一切正常。.enable().disable()

看来,为了能够以编程方式启用和禁用调试目标,我需要使用不同的语法:

但这似乎每次使用时都会创建一个新的调试实例,这将是一种浪费。而且它不是文档中描述的标准语法。而且,即便如此,.enabled()and.disabled()方法也不会返回命名空间列表。

有什么我严重误解的吗?

0 投票
0 回答
64 浏览

node.js - 纱线安装给出错误“https://registry.npmjs.org/esprima-fb/-/esprima-fb-3001.0001.0000-dev-harmony-fb.tgz:不正确的数据检查”

我的节点版本为 v12.20.0,npm 版本为 6.14.8,当我安装 Yarn 时,我得到了这个“https://registry.npmjs.org/esprima-fb/-/esprima-fb-3001.0001.0000 -dev-harmony-fb.tgz:不正确的数据检查”类错误不断。我在比利时工作,但我已经来印度几个星期了。自从在印度我开始遇到这个问题。如果这与代理或 VPN 有关,我已连接到我的 ofc vpn 并且它工作正常。对于代理我应该在哪里检查?另外有没有人遇到过这个错误?请指导我也收到了很多我在比利时时没有收到的警告

"dependencies": { "@adobe/react-native-acpanalytics": "1.2.6", "@adobe/react-native-acpcore": "1.4.0", "@adobe/react-native-aepassurance": "1.2.0", "@apollo/client": "3.3.8", "@dynatrace/react-native-plugin": "2.227.0", "@proximus/react-native-proximus-donuts": "2.0.3", "@react-native-clipboard/clipboard": "1.7.0", "@react-native-community/async-storage": "1.12.1", "@react-native-community/blur": "github:kyle-ssg/react-native-blur.git", "@react-native-community/datetimepicker": "3.4.7", "@react-native-community/geolocation": "2.0.2", "@react-native-community/masked-view": "0.1.11", "@react-native-community/netinfo": "4.7.0", "@react-native-community/progress-bar-android": "1.0.4", "@react-native-community/progress-view": "1.2.3", "@react-native-community/push-notification-ios": "1.8.0", "@react-native-community/react-native-cookies": "1.1.1", "@react-native-community/checkbox": "^0.5.7", "@react-native-firebase/analytics": "8.0.1", "@react-native-firebase/app": "9.0.0", "@react-native-firebase/crashlytics": "8.5.2", "@react-native-firebase/dynamic-links": "7.5.13", "@react-native-firebase/in-app-messaging": "7.5.10", "@react-native-firebase/messaging": "10.3.1", "@react-native-firebase/perf": "7.4.12", "@react-native-firebase/remote-config": "10.3.1", "@react-navigation/bottom-tabs": "5.11.7", "@react-navigation/core": "5.15.1", "@react-navigation/native": "5.9.2", "@react-navigation/stack": "5.14.2", "@react-navigation/drawer": "5.12.4", "@types/react-native-qrcode": "0.2.2", "@types/react-native-share": "1.1.6", "@types/semver": "7.3.4", "crypto-js": "3.3.0", "date-fns": "1.30.1", "geolib": "3.3.1", "graphql": "15.5.0", "graphql-ws": "2.0.1", "idx": "2.5.6", "localforage": "1.4.3", "lodash-es": "4.17.21", "lodash.debounce": "4.0.8", "lodash.throttle": "4.1.1", "query-string": "^6.13.6", "react": "17.0.1", "react-native": "0.64.1", "react-native-android-location-enabler": "1.2.2", "react-native-app-settings": "2.0.1", "react-native-carrier-info": "1.1.2", "react-native-check-app-install": "0.0.5", "react-native-config": "0.12.0", "react-native-counter-ts": "0.3.1", "react-native-device-info": "5.6.5", "react-native-elements": "1.2.7", "react-native-exception-handler": "2.10.9", "react-native-fs": "2.16.6", "react-native-geolocation-service": "5.2.0", "react-native-gesture-handler": "1.10.3", "react-native-get-random-values": "1.7.0", "react-native-htmlview": "0.16.0", "react-native-indicators": "0.16.0", "react-native-keychain": "6.2.0", "react-native-linear-gradient": "2.5.6", "react-native-localize": "1.4.3", "react-native-maps": "0.27.1", "react-native-network-info": "5.2.1", "react-native-netwatch": "1.2.6", "react-native-open-notification": "0.1.4", "react-native-paper": "4.8.1", "react-native-pdf": "6.3.0", "react-native-permissions": "2.2.2", "react-native-picker-select": "6.6.0", "react-native-ping": "1.2.6", "react-native-print": "0.7.0", "react-native-push-notification": "7.3.1", "react-native-qrcode-svg": "6.0.6", "react-native-rate": "1.2.9", "react-native-reanimated": "1.13.2", "react-native-render-html": "4.2.4", "react-native-responsive": "1.0.2", "react-native-safari-view": "2.1.0", "react-native-safe-area-context": "3.1.9", "react-native-screens": "2.16.1", "react-native-sensitive-info": "5.5.0", "react-native-settings": "0.2.3", "react-native-share": "3.8.5", "react-native-shared-preferences": "1.0.2", "react-native-splash-screen": "3.2.0", "react-native-super-grid": "4.0.3", "react-native-svg": "12.1.0", "react-native-svg-transformer": "0.14.3", "react-native-swipe-gestures": "1.0.5", "react-native-swipeable": "0.6.0", "react-native-user-defaults": "0.1.5", "react-native-vector-icons": "8.1.0", "react-native-view-more-text": "2.1.0", "react-native-pager-view": "5.1.10", "react-native-webview": "11.2.1", "react-navigation-backhandler": "2.0.1", "react-redux": "7.2.2", "redux": "4.0.5", "redux-action-log": "2.1.0", "redux-observable": "1.2.0", "redux-persist": "5.10.0", "redux-persist-filesystem-storage": "3.0.0", "redux-persist-sensitive-storage": "1.0.0", "redux-thunk": "2.3.0", "reselect": "4.0.0", "rgb-hex": "3.0.0", "rn-fetch-blob": "0.12.0", "rxjs": "6.6.3", "search-params": "2.1.3", "semver": "7.3.4", "subscriptions-transport-ws": "0.9.18", "url": "0.11.0", "utf8": "3.0.0", "uuid": "8.3.2", "victory-native": "35.3.3", "react-native-camera": "github:mathieusoupart-pxs/react-native-camera.git", "react-native-qrcode-scanner": "1.5.4", "react-native-wifi-reborn": "4.3.7", "react-native-tracking-transparency": "0.1.1", "xstate": "4.19.1", "@xstate/react": "1.3.3", "@proximus/atin-features": "5.25.0-4", "@proximus/atin-features": "5.23.0-4", "@proximus/fir-features": "5.24.0-1", "@proximus/external-features": "0.0.0-14" }, "devDependencies": { "@babel/core": "7.12.10", "@babel/preset-react": "7.12.10", "@babel/preset-typescript": "7.12.7", "@types/chai": "4.2.14", "@types/crypto-js": "3.1.43", "@types/enzyme": "3.10.8", "@types/express": "4.17.9", "@types/jasmine": "3.6.2", "@types/jest": "24.9.1", "@types/jsdom": "16.2.5", "@types/lodash-es": "4.17.4", "@types/lodash.debounce": "4.0.6", "@types/lodash.throttle": "4.1.6", "@types/mocha": "8.2.0", "@types/node": "12.19.0", "@types/react": "16.14.2", "@types/react-native": "0.63.52", "@types/react-native-htmlview": "0.12.2", "@types/react-native-i18n": "2.0.0", "@types/react-native-safari-view": "2.0.4", "@types/react-native-vector-icons": "6.4.6", "@types/react-redux": "7.1.12", "@types/react-test-renderer": "16.9.4", "@wdio/allure-reporter": "6.11.0", "@wdio/browserstack-service": "6.10.10", "@wdio/cli": "6.10.11", "@wdio/local-runner": "6.10.13", "@wdio/mocha-framework": "6.10.11", "@wdio/spec-reporter": "6.10.6", "@wdio/sync": "6.10.11", "allure-commandline": "2.13.8", "appium": "1.22.0", "appium-webdriveragent": "3.9.2", "babel-jest": "26.6.3", "babel-plugin-module-resolver": "4.1.0", "babel-plugin-transform-es2015-modules-commonjs": "6.26.2", "chai": "4.2.0", "chromedriver": "90.0.0", "enzyme": "3.11.0", "enzyme-adapter-react-16": "1.15.5", "enzyme-to-json": "3.6.1", "express": "4.17.1", "jest": "26.6.3", "jest-date-mock": "1.0.8", "jest-fetch-mock": "2.1.2", "jest-html-reporters": "2.1.2", "jest-sonar-reporter": "2.0.0", "madge": "5.0.1", "metro-react-native-babel-preset": "0.64.0", "mock-async-storage": "2.2.0", "node-fetch": "2.1.2", "prettier": "1.19.1", "react-dom": "16.14.0", "react-native-clean-project": "3.4.0", "react-test-renderer": "17.0.1", "reactotron-react-native": "5.0.0", "reactotron-redux": "3.1.3", "redux-mock-store": "1.5.4", "shelljs": "0.7.8", "ts-jest": "26.4.4", "ts-node": "9.1.1", "tslint": "5.20.1", "tslint-config-airbnb-base": "0.3.0", "tslint-config-prettier": "1.18.0", "tslint-etc": "1.13.9", "tslint-react": "4.2.0", "typescript": "4.1.5", "tsconfig-paths": "3.9.0" },