无法在安装 TypeScript 的 CRA 后运行 **npm start**。

huangapple go评论52阅读模式
英文:

cannot run **npm start** after installing cra with typescript

问题

I'm trying to get started with react & typescript. After creating an empty folder in vscode then I create a TypeScript app with npx create-react-app react-script-demo --template typescript, the installation completed. But after running npm start, I got these errors:

'typescript\react-script-demo\node_modules.bin' is not recognized as an internal or external command,
operable program or batch file.
node:internal/modules/cjs/loader:936
throw err;
^

Error: Cannot find module 'C:*******\react-scripts\bin\react-scripts.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}

I checked other questions on StackOverflow, but none of them worked for me.

英文:

I'm trying to get started with react & typescript . After creating an empty folder in vscode then I create a TypeScript app with npx create-react-app react-script-demo --template typescript the installating completed . but after running npm start . I got theese errors :

> 'typescript\react-script-demo\node_modules.bin' is not recognized as an internal or external command,
> operable program or batch file.
> node:internal/modules/cjs/loader:936
> throw err;
> ^
>
> Error: Cannot find module 'C:*******\react-scripts\bin\react-scripts.js'
> at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
> at Function.Module._load (node:internal/modules/cjs/loader:778:27)
> at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
> at node:internal/main/run_main_module:17:47 {
> code: 'MODULE_NOT_FOUND',
> requireStack: []
> }

I checked other question in stackoverflow but none of them worked for me

答案1

得分: 1

这个错误与安装无关。我发现错误是因为父文件夹的名称包含 & (Ampersand)。将该文件夹重命名为不含 & 符号解决了问题。

英文:

this error has nothing to do with the installation. I figured out that the error is coming from the name of the parent folder containing an & (Ampersand) . renaming this folder with no & symbol solved the problem

huangapple
  • 本文由 发表于 2023年5月14日 10:01:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/76245525.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定