我有一个使用 create-react-app 创建的简单反应项目。创建项目后,yarn test 命令工作正常,然后我开始添加一些实际的反应代码,最终在执行测试后出现此错误:
\n\nPASS src/test/App.test.js\n \xe2\x9c\x93 renders without crashing (28ms)\n\nTest Suites: 1 passed, 1 total\nTests: 1 passed, 1 total\nSnapshots: 0 total\nTime: 0.729s, estimated 1s\nRan all test suites related to changed files.\n\nWatch Usage\n \xe2\x80\xba Press a to run all tests.\n \xe2\x80\xba Press p to filter by a filename regex pattern.\n \xe2\x80\xba Press t to filter by a test name regex pattern.\n \xe2\x80\xba Press q to quit watch mode.\n \xe2\x80\xba Press Enter to trigger a test run.\n/Users/mpegorar/Development/SpringApps/fluxy_frontend/node_modules/react-scripts/scripts/test.js:20\n throw err;\n …Run Code Online (Sandbox Code Playgroud) 我的“ App.vue”样式是:
<style lang="stylus">
@import "../node_modules/font-awesome/css/font-awesome.css"
@import "~bootstrap-4-grid"
@import "assets/styl/app.styl"
</style>
Run Code Online (Sandbox Code Playgroud)
跑步后
yarn dev
Run Code Online (Sandbox Code Playgroud)
在默认的vue-cli webpack配置上,我正在获取:
These relative modules were not found:
* ../fonts/fontawesome-webfont.eot in ./node_modules/css-loader?{"sourceMap":false}!./node_modules/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-04c2046b","scoped":false,"hasInlineConfig":false}!./node_modules/stylus-loader?{"sourceMap":false}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0&bustCache!./src/App.vue
* ../fonts/fontawesome-webfont.eot?v=4.7.0 in ./node_modules/css-loader?{"sourceMap":false}!./node_modules/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-04c2046b","scoped":false,"hasInlineConfig":false}!./node_modules/stylus-loader?{"sourceMap":false}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0&bustCache!./src/App.vue
* ../fonts/fontawesome-webfont.svg?v=4.7.0 in ./node_modules/css-loader?{"sourceMap":false}!./node_modules/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-04c2046b","scoped":false,"hasInlineConfig":false}!./node_modules/stylus-loader?{"sourceMap":false}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0&bustCache!./src/App.vue
* ../fonts/fontawesome-webfont.ttf?v=4.7.0 in ./node_modules/css-loader?{"sourceMap":false}!./node_modules/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-04c2046b","scoped":false,"hasInlineConfig":false}!./node_modules/stylus-loader?{"sourceMap":false}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0&bustCache!./src/App.vue
* ../fonts/fontawesome-webfont.woff2?v=4.7.0 in ./node_modules/css-loader?{"sourceMap":false}!./node_modules/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-04c2046b","scoped":false,"hasInlineConfig":false}!./node_modules/stylus-loader?{"sourceMap":false}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0&bustCache!./src/App.vue
* ../fonts/fontawesome-webfont.woff?v=4.7.0 in ./node_modules/css-loader?{"sourceMap":false}!./node_modules/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-04c2046b","scoped":false,"hasInlineConfig":false}!./node_modules/stylus-loader?{"sourceMap":false}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0&bustCache!./s
Run Code Online (Sandbox Code Playgroud)
有人遇到过同样的问题吗?
我已将 lerna 设置切换为使用 Yarn Workspace。现在我有一个包含所有包依赖项的根 node_modules。每个包中的 node_modules 只有一个 .bin 文件夹。
使用此设置,webpack 无法解析依赖项。我需要像这样更改我的配置文件:
resolve: {
symlinks: false, <-- +
modules: [
helpers.getPath('src'),
helpers.getPath('node_modules'),
helpers.getPath('../../node_modules'), <-- +
]
...others settings...
}
Run Code Online (Sandbox Code Playgroud)
关于这个设置的两个问题:
为什么我需要添加符号链接属性?我有很多错误没有。
这是工作区在 webpack 中添加相对解析器的正常行为吗(我有一些包裹在 dotnet 解决方案中的包,我需要添加一个非常长的相对路径,如 ../../../../.. /../node_modules) ?
我想开发2 个版本相同但版本不同的包:
第一的
// package.json
{
"name":"mypackage",
"version": "1.0.0-base"
}
Run Code Online (Sandbox Code Playgroud)
第二
// package.json
{
"name":"mypackage",
"version": "2.0.0-next"
}
Run Code Online (Sandbox Code Playgroud)
现在我想在两个不同的项目中做:
npm link <path to mypackage@1.0.0-base>
或者
npm link <path to mypackage@2.0.0-next>
现在,当我这样做时,上一个链接的包“替换”了以前链接项目中名称为mypackage的每个链接模块。
我知道npm具有用于链接的“全局空间”……但是有什么办法可以解决这个问题吗?
我很抱歉提出关于这个一般问题的另一个问题,但我在 SO 上发现的问题似乎都与我的问题密切相关。
我有一个现有的、工作的数据流管道,它接受对象KV<Long, Iterable<TableRow>>并输出TableRow对象。这段代码在我们的生产环境中,运行没有问题。然而,我现在正在尝试使用直接运行器实现单元测试来测试此管道,但是单元测试在到达线路时失败
LinkedHashMap<String, Object> evt = (LinkedHashMap<String, Object>) row.get(Schema.EVT);
Run Code Online (Sandbox Code Playgroud)
在管道中,抛出错误消息:
java.lang.ClassCastException:com.google.gson.internal.LinkedTreeMap 无法转换为 java.util.LinkedHashMap
现有数据流代码的简化版本如下所示:
public static class Process extends DoFn<KV<Long, Iterable<TableRow>>, TableRow> {
/* private variables */
/* constructor */
/* private functions */
@ProcessElement
public void processElement(ProcessContext c) throws InterruptedException, ParseException {
EventProcessor eventProc = new EventProcessor();
Processor.WorkItem workItem = new Processor.WorkItem();
Iterator<TableRow> it = c.element().getValue().iterator();
// process all TableRows having the same id
while (it.hasNext()) {
TableRow item = it.next();
if …Run Code Online (Sandbox Code Playgroud) 我有以下 css 文件:
<link rel="stylesheet" href="style/select.css">
<link rel="stylesheet" href="style/site.css">
Run Code Online (Sandbox Code Playgroud)
以及以下 webpack 配置
var path = require("path");
module.exports = {
entry: {
app: './src/index.js'
},
output: {
path: path.resolve(__dirname + '/dist'),
filename: '[name].js',
},
module: {
rules: [
{
test: /\.(css|scss)$/,
use: [
'style-loader',
'css-loader',
]
},
{
test: /\.html$/,
exclude: /node_modules/,
loader: 'file-loader?name=[name].[ext]',
},
{
test: /\.elm$/,
exclude: [/elm-stuff/, /node_modules/],
loader: 'elm-webpack-loader?verbose=true&warn=true',
options: {debug: true, warn: true},
},
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'url-loader?limit=10000&mimetype=application/font-woff',
},
{
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file-loader',
}, …Run Code Online (Sandbox Code Playgroud) javascript webpack webpack-dev-server webpack-style-loader yarnpkg
我有一个问题,使用Laradock和纱线与容器docker exec"外"的内联命令workspace.
当我从workspace容器内部使用它时,一切都按预期工作:
docker exec -it --user=laradock laradock_workspace_1 bash
yarn -v
1.3.2
Run Code Online (Sandbox Code Playgroud)
当我尝试从内联命令使用它时,会发生以下情况:
docker exec -it --user=laradock laradock_workspace_1 yarn -v
OCI runtime exec failed: exec failed: container_linux.go:296: starting container process caused "exec: \"yarn\": executable file not found in $PATH": unknown
Run Code Online (Sandbox Code Playgroud)
我做错了吗?
在第一次将应用程序迁移到 Rails 5.1 时,我尝试使用 yarn 而不是 bower 来管理前端依赖项。
一切都很好,我可以通过相关的清单文件包含js和文件。cssapplication.js/css
但是,如果这些文件依赖于其他资源(例如,图像、字体等的目录),那么 Rails 对它们一无所知。
给定一个纱线包,其中包括:
/css
|-styles.css
/images
|-background.jpg
Run Code Online (Sandbox Code Playgroud)
在哪里
#styles.css
.background {
background-image: url(../images/background.jpg);
}
Run Code Online (Sandbox Code Playgroud)
日志(显然)显示
No route matches [GET] "/images/background.jpg"
Run Code Online (Sandbox Code Playgroud)
如何确保 Rails 知道 Yarn 包中的这些图像并正确编译它们?
这可能吗?还是我忽略了一些明显的东西?
我的开发环境是Vagrant ScotchBox,节点6.6.2,Npm 3.9.5。
我正在尝试使用Mix编译Laravel项目的资产。
yarn install
yarn run dev
Run Code Online (Sandbox Code Playgroud)
与yarn run dev我得到sh:1:跨环境:权限被拒绝
yarn install
yarn run dev
Run Code Online (Sandbox Code Playgroud)
拜托,有人可以帮我吗?
问候
/////////////////
也许我的package.json是错误的
sh: 1: cross-env: Permission denied
npm ERR! Linux 3.13.0-55-generic
npm ERR! argv "/home/vagrant/.nvm/versions/node/v6.2.2/bin/node" "/home/vagrant/.nvm/versions/node/v6.2.2/bin/npm" "run" "development"
npm ERR! node v6.2.2
npm ERR! npm v3.9.5
npm ERR! code ELIFECYCLE
npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the @ development script 'cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js …Run Code Online (Sandbox Code Playgroud)我已经对我在笔记本电脑上工作的本地项目做出了反应。当我将项目转移到我的PC并运行yarn安装时(我使用yarn安装了一些模块,使用npm安装了一些模块)
发生意外错误:“ https://registry.yarnpkg.com/jest/-/jest-23.0.0-alpha.0.tgz:请求失败“找不到404”。
我的PC和Latop上的纱线版本相同
1.5.1
Run Code Online (Sandbox Code Playgroud)
NPM版本我的电脑和笔记本电脑相同
5.4.1
Run Code Online (Sandbox Code Playgroud)
节点版本
v 7.9.0
Run Code Online (Sandbox Code Playgroud)
另外,在我的项目上运行yarn安装时,我会收到警告
warning You are using Node "7.9.0" which is not supported and may encounter bugs or unexpected behavior. Yarn supports the following semver range: "^4.8.0 || ^5.7.0 || ^6.2.2 || >=8.0.0"
Run Code Online (Sandbox Code Playgroud) yarnpkg ×9
node.js ×4
npm ×3
webpack ×3
apache-beam ×1
bower ×1
dataflow ×1
docker ×1
exec ×1
java ×1
javascript ×1
laradock ×1
laravel ×1
laravel-mix ×1
lerna ×1
react-native ×1
reactjs ×1
stylus ×1
vuejs2 ×1
workspace ×1