小编wuy*_*udi的帖子

npm 错误!为 Node 项目创建 Docker 镜像时,跟踪器“idealTree”已经存在

我创建了一个名为 simpleWeb 的 node.js 项目。该项目包含 package.json 和 index.js。

索引.js

    const express = require('express');
    
    const app = express();
    
    app.get('/', (req, res) => {
      res.send('How are you doing');
    });
    
    app.listen(8080, () => {
      console.log('Listening on port 8080');
    });
Run Code Online (Sandbox Code Playgroud)

包.json


    {
        "dependencies": {
          "express": "*"
        },
        "scripts": {
          "start": "node index.js"
        }
      }
Run Code Online (Sandbox Code Playgroud)

我还创建了一个 Dockerfile 来为我的 node.js 项目创建 docker 镜像。

文件

# Specify a base image
FROM node:alpine

# Install some dependencies 
COPY ./ ./
RUN npm install

# Default command
CMD ["npm", …
Run Code Online (Sandbox Code Playgroud)

docker dockerfile

37
推荐指数
5
解决办法
2万
查看次数

以 svelte 方式显示文件内容

我正在使用此代码上传文件。我想显示文件的内容,但我得到的只是 [目标文件] 而没有其他内容。有没有办法以 svelte 显示文件内容?

文件text2.txt:

1 2 3 4 5 6
7 8 9 10 11 1
Run Code Online (Sandbox Code Playgroud)

测试.svelte:

    <script>
      import { onMount } from "svelte"
      // d3.csv(' http://127.0.0.1:8081/test.csv').then(function(data) {
      //   console.log(data[0])})
    
      let files;
      $: if (files) {
        console.log(files);
        for (const file of files) {
          console.log(`${file.name}: ${file.size} bytes`);
        }
      }
    
    </script>
    
    <p>...from test</p>
    
    <input type='file' bind:files>
    
    {#if files}
        <h2>Selected files:</h2>
        {#each Array.from(files) as file,i}
            <p>{file.name} ({file.size} bytes)</p>
                    <p>e: {file} i: {i}</p>
        {/each}
        <p>files length: {files.length}</p>
    {/if}
Run Code Online (Sandbox Code Playgroud)

要重现此内容,只需将其粘贴到 svelte REPL 中即可。

file read-eval-print-loop svelte

4
推荐指数
1
解决办法
4787
查看次数

如何从 sympy 中删除系列中的“O()”

我想画一个函数的泰勒展开式,例如:sin

from sympy import *
from sympy.plotting import *
m, x = symbols("m x")
plot(*Array([2, 4, 6]).applyfunc(lambda m: sin(x).series(x0=0, n=m)), (x, -pi/2, pi/2))
Run Code Online (Sandbox Code Playgroud)

但是,既然Array([2, 4, 6]).applyfunc(lambda m: sin(x).series(x0=0, n=m)给出了

sympy 无法绘制它们。

所以我想知道有没有办法删除O(x^n)?在 Mathematica 中,我可以用来Normal做到这一点。

python sympy

1
推荐指数
1
解决办法
1425
查看次数

标签 统计

docker ×1

dockerfile ×1

file ×1

python ×1

read-eval-print-loop ×1

svelte ×1

sympy ×1