我去年开始使用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文件中