gpt4 book ai didi

node.js - Ubuntu上的node_modules(或npm)有什么问题

转载 作者:行者123 更新时间:2023-12-04 18:49:16 30 4
gpt4 key购买 nike

我去年开始使用 Ubuntu,从今天开始我遇到了非常烦人的问题。首先问题是带有脚本错误的 Reactjs,我什至无法启动项目,无论如何我以不同的方式解决了。现在我面临问题

  • 使用 Typescript 项目启动 Reactjs,如上述错误和
  • 启动 Vuejs 项目。

  • 我用谷歌搜索了问题,但没有任何帮助。我不知道如何永久解决这类问题(我在 Ubuntu 上没有更多经验),但我想这可能是 node_modules 或 npm 文件夹中的错误路径问题。我检查了所有权限,使用 sudo 安装了软件包,我认为这不是权限问题。但是我的文件夹结构看起来很脏,需要清理。如果您想从系统中获得更多信息,我可以提供您想要的一切。我会很高兴有任何帮助!
    我的笔记本电脑:HP Pavilion g6,Ubuntu 20.04
    React Typescript 项目尝试启动
    /usr/lib/node_modules/react-scripts/scripts/start.js:19
    throw err;
    ^

    Error: Failed to load plugin '@typescript-eslint' declared in 'package.json » eslint-config-react-app#overrides[0]': Cannot find module 'typescript'
    Require stack:
    - /usr/lib/node_modules/react-scripts/node_modules/tsutils/typeguard/2.8/node.js
    - /usr/lib/node_modules/react-scripts/node_modules/tsutils/typeguard/2.9/node.js
    - /usr/lib/node_modules/react-scripts/node_modules/tsutils/typeguard/3.0/node.js
    - /usr/lib/node_modules/react-scripts/node_modules/tsutils/typeguard/3.2/node.js
    - /usr/lib/node_modules/react-scripts/node_modules/tsutils/typeguard/node.js
    - /usr/lib/node_modules/react-scripts/node_modules/tsutils/typeguard/index.js
    - /usr/lib/node_modules/react-scripts/node_modules/tsutils/index.js
    - /usr/lib/node_modules/react-scripts/node_modules/@typescript-eslint/eslint-plugin/dist/util/isTypeReadonly.js
    - /usr/lib/node_modules/react-scripts/node_modules/@typescript-eslint/eslint-plugin/dist/util/index.js
    - /usr/lib/node_modules/react-scripts/node_modules/@typescript-eslint/eslint-plugin/dist/rules/adjacent-overload-signatures.js
    - /usr/lib/node_modules/react-scripts/node_modules/@typescript-eslint/eslint-plugin/dist/rules/index.js
    - /usr/lib/node_modules/react-scripts/node_modules/@typescript-eslint/eslint-plugin/dist/index.js
    - /usr/lib/node_modules/react-scripts/node_modules/@eslint/eslintrc/lib/config-array-factory.js
    - /usr/lib/node_modules/react-scripts/node_modules/@eslint/eslintrc/lib/index.js
    - /usr/lib/node_modules/react-scripts/node_modules/eslint/lib/cli-engine/cli-engine.js
    - /usr/lib/node_modules/react-scripts/node_modules/eslint/lib/cli-engine/index.js
    - /usr/lib/node_modules/react-scripts/node_modules/eslint/lib/api.js
    - /usr/lib/node_modules/react-scripts/node_modules/eslint-webpack-plugin/dist/getESLint.js
    - /usr/lib/node_modules/react-scripts/node_modules/eslint-webpack-plugin/dist/linter.js
    - /usr/lib/node_modules/react-scripts/node_modules/eslint-webpack-plugin/dist/index.js
    - /usr/lib/node_modules/react-scripts/node_modules/eslint-webpack-plugin/dist/cjs.js
    - /usr/lib/node_modules/react-scripts/config/webpack.config.js
    - /usr/lib/node_modules/react-scripts/scripts/start.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:925:15)
    at Function.Module._load (node:internal/modules/cjs/loader:769:27)
    at Module.require (node:internal/modules/cjs/loader:997:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.<anonymous> (/usr/lib/node_modules/react-scripts/node_modules/tsutils/typeguard/2.8/node.js:3:12)
    at Module._compile (node:internal/modules/cjs/loader:1108:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
    at Module.load (node:internal/modules/cjs/loader:973:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Module.require (node:internal/modules/cjs/loader:997:19) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
    '/usr/lib/node_modules/react-scripts/node_modules/tsutils/typeguard/2.8/node.js',
    '/usr/lib/node_modules/react-scripts/node_modules/tsutils/typeguard/2.9/node.js',
    '/usr/lib/node_modules/react-scripts/node_modules/tsutils/typeguard/3.0/node.js',
    '/usr/lib/node_modules/react-scripts/node_modules/tsutils/typeguard/3.2/node.js',
    '/usr/lib/node_modules/react-scripts/node_modules/tsutils/typeguard/node.js',
    '/usr/lib/node_modules/react-scripts/node_modules/tsutils/typeguard/index.js',
    '/usr/lib/node_modules/react-scripts/node_modules/tsutils/index.js',
    '/usr/lib/node_modules/react-scripts/node_modules/@typescript-eslint/eslint-plugin/dist/util/isTypeReadonly.js',
    '/usr/lib/node_modules/react-scripts/node_modules/@typescript-eslint/eslint-plugin/dist/util/index.js',
    '/usr/lib/node_modules/react-scripts/node_modules/@typescript-eslint/eslint-plugin/dist/rules/adjacent-overload-signatures.js',
    '/usr/lib/node_modules/react-scripts/node_modules/@typescript-eslint/eslint-plugin/dist/rules/index.js',
    '/usr/lib/node_modules/react-scripts/node_modules/@typescript-eslint/eslint-plugin/dist/index.js',
    '/usr/lib/node_modules/react-scripts/node_modules/@eslint/eslintrc/lib/config-array-factory.js',
    '/usr/lib/node_modules/react-scripts/node_modules/@eslint/eslintrc/lib/index.js',
    '/usr/lib/node_modules/react-scripts/node_modules/eslint/lib/cli-engine/cli-engine.js',
    '/usr/lib/node_modules/react-scripts/node_modules/eslint/lib/cli-engine/index.js',
    '/usr/lib/node_modules/react-scripts/node_modules/eslint/lib/api.js',
    '/usr/lib/node_modules/react-scripts/node_modules/eslint-webpack-plugin/dist/getESLint.js',
    '/usr/lib/node_modules/react-scripts/node_modules/eslint-webpack-plugin/dist/linter.js',
    '/usr/lib/node_modules/react-scripts/node_modules/eslint-webpack-plugin/dist/index.js',
    '/usr/lib/node_modules/react-scripts/node_modules/eslint-webpack-plugin/dist/cjs.js',
    '/usr/lib/node_modules/react-scripts/config/webpack.config.js',
    '/usr/lib/node_modules/react-scripts/scripts/start.js'
    ]
    }
    npm ERR! code 1
    npm ERR! path /home/ramil/D:/Codes/dev-challanges/todo-app
    npm ERR! command failed
    npm ERR! command sh -c react-scripts start

    npm ERR! A complete log of this run can be found in:
    npm ERR! /home/ramil/.npm/_logs/2020-12-29T20_34_08_108Z-debug.log
    Vuejs项目启动项目问题
    > myapp@0.1.0 serve
    > vue-cli-service serve

    node:internal/modules/cjs/loader:928
    throw err;
    ^

    Error: Cannot find module '@vue/cli-plugin-babel'
    Require stack:
    - /usr/lib/node_modules/@vue/cli-service/lib/Service.js
    - /usr/lib/node_modules/@vue/cli-service/bin/vue-cli-service.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:925:15)
    at Function.Module._load (node:internal/modules/cjs/loader:769:27)
    at Module.require (node:internal/modules/cjs/loader:997:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at idToPlugin (/usr/lib/node_modules/@vue/cli-service/lib/Service.js:145:14)
    at /usr/lib/node_modules/@vue/cli-service/lib/Service.js:184:20
    at Array.map (<anonymous>)
    at Service.resolvePlugins (/usr/lib/node_modules/@vue/cli-service/lib/Service.js:170:10)
    at new Service (/usr/lib/node_modules/@vue/cli-service/lib/Service.js:32:25)
    at Object.<anonymous> (/usr/lib/node_modules/@vue/cli-service/bin/vue-cli-service.js:15:17) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
    '/usr/lib/node_modules/@vue/cli-service/lib/Service.js',
    '/usr/lib/node_modules/@vue/cli-service/bin/vue-cli-service.js'
    ]
    }
    npm ERR! code 1
    npm ERR! path /home/ramil/D:/Codes/Vue-apps/myapp
    npm ERR! command failed
    npm ERR! command sh -c vue-cli-service serve

    npm ERR! A complete log of this run can be found in:
    npm ERR! /home/ramil/.npm/_logs/2020-12-29T21_04_13_325Z-debug.log

    最佳答案

    固定的

  • 从 (D) 更改了主文件夹 (D:) 的名称 - 我不知道它是否受影响,但删除了符号。
  • 我添加了 export PATH=$PATH:/usr/bin到 .bashrc 文件
  • 关于node.js - Ubuntu上的node_modules(或npm)有什么问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65498860/

    30 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com