尝试导入本地文件时出现错误,但在使用 npm 包时没有问题。
import express from 'express'
import next from 'next'
import apis from './src/server/api'
Run Code Online (Sandbox Code Playgroud)
export default {
ello: 'bye',
jamie: 'hey'
}
Run Code Online (Sandbox Code Playgroud)
node --experimental-modules --inspect server.js
Run Code Online (Sandbox Code Playgroud)
For help, see: https://nodejs.org/en/docs/inspector
(node:20153) ExperimentalWarning: The ESM module loader is experimental.
internal/modules/esm/default_resolve.js:59
let url = moduleWrapResolve(specifier, parentURL);
^
Error: Cannot find module '/var/www/goldendemon.hutber.com/src/server/api' imported from /var/www/goldendemon.hutber.com/server.js
at Loader.resolve [as _resolve] (internal/modules/esm/default_resolve.js:59:13)
at Loader.resolve (internal/modules/esm/loader.js:70:33)
at Loader.getModuleJob (internal/modules/esm/loader.js:143:40)
at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:43:40)
at link (internal/modules/esm/module_job.js:42:36) {
code: 'ERR_MODULE_NOT_FOUND'
}
Run Code Online (Sandbox Code Playgroud) 背景
我刚刚开始使用grunt大约30分钟前.所以忍受我.
但是我有一个相当简单的脚本,它将查看我的js,然后将它压缩成一个文件给我.
码
"use strict";
module.exports = function (grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
beautify: true,
report: 'gzip'
},
build: {
src: ['docroot/js/*.js', 'docroot/components/pages/*.js', 'docroot/components/plugins/*.js'],
dest: 'docroot/js/main.min.js'
}
},
watch: {
options: {
dateFormat: function(time) {
grunt.log.writeln('The watch finished in ' + time + 'ms at' + (new Date()).toString());
grunt.log.writeln('Waiting for more changes...');
}
},
js: {
files: '<%= uglify.build.src %>',
tasks: ['uglify']
}
}
});
grunt.registerTask('default', 'watch');
}
Run Code Online (Sandbox Code Playgroud)
题 …
use strict
启用时是否可以看到函数的被调用者/调用者?
'use strict';
function jamie (){
console.info(arguments.callee.caller.name);
//this will output the below error
//uncaught TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them
};
function jiminyCricket (){
jamie();
}
jiminyCricket ();
Run Code Online (Sandbox Code Playgroud)
我刚刚安装了新的Android Studio,我正在寻找一种方法来获得CSS和JS的支持(自动完成,突出显示不正确的用法),就像我在PHPStorm和WebStorm这两种intelliJ产品一样.
我用谷歌搜索,甚至将它添加到'文件类型',但他们只是显示为纯文本文件.
我无法对此提出一个很好的解释,但是当我加入时
<script type="text/javascript" src="phonegap.js"></script>
Run Code Online (Sandbox Code Playgroud)
在我没有修改的Phonegap应用程序中,屏幕上会出现2个弹出窗口.
//The first popup
gap:["PluginManager","startup","PluginManager224542697"]
//the second
gap:["App","show","App224542698"]
Run Code Online (Sandbox Code Playgroud)
我必须取消两个弹出窗口,并且真的很想理解这个推理.
有问题的两行是在phonegap.js的21117和21118行
// Tell the native code that a page change has occurred.
require('cordova/exec')(null, null, 'PluginManager', 'startup', []);
require('cordova/channel').onNativeReady.fire();
Run Code Online (Sandbox Code Playgroud)
这当然不会在应用程序中破坏,但它确实意味着开发几乎是不可能的.
我目前正在使用node和nodemon.然后我开始认为使用具有节点的检查器可能有时很好,所以已经开始使用node-inspector
但是,是否可以同时运行两个?
通常运行nodemon我会使用:
nodemon server.js
//and similarly
node-debug server.js
Run Code Online (Sandbox Code Playgroud)
我也尝试过:
nodemon --debug http.js
Run Code Online (Sandbox Code Playgroud)
但遗憾的是,这也没有用.
但两者在一起!?
我希望能够增加watch
在任务gulp
到所有的js
中的文件frontend/js
和低于任何其他js文件
gulp.watch('./frontend/js/**/*.js', ['browserify']);
Run Code Online (Sandbox Code Playgroud)
这只会将js
文件定位到一个文件夹深处
道歉,因为我意识到这不应该是在stackoverflow和他的一个姐妹脱离的.
但它让我疯狂,但当我点击一条线的白色空间时,它会走到一条线的尽头.
我在另一台机器上进行了全新安装但它没有这样做,所以我知道它的版本.
我点击设置中的小'重置'没有运气.
我想将我的 jest 配置移出我的 package.json,我正在尝试按照此处的建议使用 --config,但出现错误argv.config.match is not a function
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --config jest.config.js",
"eject": "react-scripts eject",
},
Run Code Online (Sandbox Code Playgroud)
hutber@hutber-mac:/var/www/management/node$ npm test -u
> management-fresh@0.1.0 test /var/www/management/node
> react-scripts test --config jest.config.js
Usage: test.js [--config=<pathToConfigFile>] [TestPathPattern]
argv.config.match is not a function
npm ERR! Test failed. See above for more details.
Run Code Online (Sandbox Code Playgroud) javascript ×7
node.js ×3
android ×2
phpstorm ×2
cordova ×1
ecmascript-6 ×1
gruntjs ×1
gulp ×1
jestjs ×1
nodemon ×1
reactjs ×1
testing ×1
uglifyjs ×1
use-strict ×1
whitespace ×1