"Error: Cannot find source file" when building on Windows
See original GitHub issuepackage.json:
{
"name": "index",
"version": "1.0.0",
"description": "",
"main": "index.html",
"scripts": {
"build": "parcel build index.html"
},
"devDependencies": {
"@types/react": "^16.0.37",
"@types/react-dom": "^16.0.4",
"autoprefixer": "^8.0.0",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1",
"parcel-bundler": "^1.5.1",
"parcel-plugin-typescript": "^0.6.0",
"typescript": "^2.7.1"
},
"dependencies": {
"react": "^16.2.0",
"react-dom": "^16.2.0"
}
}
index.html:
<html>
<body>
<div id="root"></div>
<script src="./Index.tsx"></script>
</body>
</html
tsconfig.json:
{
"compileOnSave": false,
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"lib": ["dom", "es2015", "es2016", "es2017.object"],
"jsx": "preserve",
"target": "es2017",
"module": "es2015",
"moduleResolution": "node",
"strict": true,
"sourceMap": true,
"skipLibCheck": true,
"noEmitHelpers": true,
"importHelpers": true,
"baseUrl": ".",
"paths": {
"*": ["*"]
}
},
"parcelTsPluginOptions": {
"transpileOnly": false
}
}
.babelrc
{
"presets": ["env", "react"]
}
Index.tsx:
import React from "react";
import ReactDOM from "react-dom";
const App = () => <div>Hello World!</div>;
ReactDOM.render(<App />, document.getElementById("root"));
Running: parcel build index.html
results in following error:
Error: Error: Error: Cannot find source file "C:\projects\parcel-ts\Index.tsx"
at TypeScriptCompiler.compile (C:\projects\parcel-ts\node_modules\parcel-plugin-typescript\build\backend\compiler\tsc.js:25:19)
at Object.<anonymous> (C:\projects\parcel-ts\node_modules\parcel-plugin-typescript\build\backend\worker\launcher.js:28:29)
at Generator.next (<anonymous>)
at fulfilled (C:\projects\parcel-ts\node_modules\tslib\tslib.js:104:62)
at <anonymous>
at TypeScriptWorker.<anonymous> (C:\projects\parcel-ts\node_modules\parcel-plugin-typescript\build\ipc\worker\index.js:27:19)
at Generator.next (<anonymous>)
at fulfilled (C:\projects\parcel-ts\node_modules\tslib\tslib.js:104:62)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
at IncomingMessage.res.setEncoding.on (C:\projects\parcel-ts\node_modules\parcel-plugin-typescript\build\ipc\client.js:31:32)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1055:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
Issue Analytics
- State:
- Created 6 years ago
- Comments:15 (4 by maintainers)
Top Results From Across the Web
VC++ can't find source file even when dependency & include ...
Hi, I'm trying to build my program, but it can't find a certain source file, because the file is moved to another location...
Read more >Why am I getting Error Cannot find source file in cmake?
add_library(myprojlib SHARED SOURCE) should be add_library(myprojlib ... The ${} syntax makes it clear that SOURCE is a CMake variable.
Read more >Visual Studio does not find source files - Visual Studio Feedback
File -> New -> Project... Visual C++ -> Windows Console Application Location: C:\Code\project-name\example4 [_] create folder for solution [Ok]
Read more >Visual Studio Build: Cannot locate source files #9 - GitHub
Cloned the repo and tried building the cuckoomon.sln file with Visual Studio 2017, using the platform v140 toolset. Ran into errors source ......
Read more >Project Import and Build errors in CCS
Introduction. This page describes how to troubleshoot and resolve some of the common project import and build errors in CCS.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@severisv and @Vitegor : I confirm that I’m able to reproduce your bug. It only happens on Windows though.
Could you try
parcel-plugin-typescript@0.6.1-next.2
? I tested it on Windows 10 with both of your reproductions and it works. If it doesn’t please check if you have the right version usingyarn list
ornpm ls
.I can confirm that it works for me aswell. Thank you!