Reputation: 61
I have a project in JavaScript that works with parcel 2 bundler just fine on Windows. But when I try to run the same code in Ubuntu, it does not work and gives errors. Here I am giving the error and the package.json. I have searched many places and tried many solutions like cleaning the cache and reinstalling but they did not help. As I said this works in Windows.
Error that I got when I try to run npm run dev
ffa@ffa-ubuntu:~/Desktop/javascript-forkify$ npm run dev
> [email protected] dev /home/ffa/Desktop/javascript-forkify
> parcel index.html
/home/ffa/Desktop/javascript-forkify/node_modules/@parcel/core/lib/Parcel.js:149
#requestTracker
^
SyntaxError: Invalid or unexpected token
at new Script (vm.js:83:7)
at NativeCompileCache._moduleCompile (/home/ffa/Desktop/javascript-forkify/node_modules/v8-compile-cache/v8-compile-cache.js:240:18)
at Module._compile (/home/ffa/Desktop/javascript-forkify/node_modules/v8-compile-cache/v8-compile-cache.js:184:36)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (/home/ffa/Desktop/javascript-forkify/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at Object.<anonymous> (/home/ffa/Desktop/javascript-forkify/node_modules/@parcel/core/lib/index.js:75:39)
/home/ffa/Desktop/javascript-forkify/node_modules/@parcel/logger/lib/Logger.js:41
#logEmitter
^
SyntaxError: Invalid or unexpected token
at new Script (vm.js:83:7)
at NativeCompileCache._moduleCompile (/home/ffa/Desktop/javascript-forkify/node_modules/v8-compile-cache/v8-compile-cache.js:240:18)
at Module._compile (/home/ffa/Desktop/javascript-forkify/node_modules/v8-compile-cache/v8-compile-cache.js:184:36)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at _logger (/home/ffa/Desktop/javascript-forkify/node_modules/parcel/lib/cli.js:54:16)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: `parcel index.html`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/ffa/.npm/_logs/2021-08-16T10_32_03_227Z-debug.log
package.json
{
"name": "forkify",
"version": "1.0.0",
"description": "",
"default": "index.html",
"scripts": {
"dev": "parcel index.html",
"build": "parcel build index.html --dist-dir dist",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Fatih Furkan Aydemir",
"license": "ISC",
"devDependencies": {
"parcel": "^2.0.0-rc.0",
"sass": "^1.37.5"
},
"dependencies": {
"core-js": "^3.16.1",
"regenerator-runtime": "^0.13.9"
}
}
Folder Structure
forkify-architecture-recipe-loading.png
forkify-flowchart-part-1.png
forkify-flowchart-part-2.png
forkify-flowchart-part-3.png
index.html
node_modules
package.json
package-lock.json
page.png
README.md
src
Upvotes: 1
Views: 1298
Reputation: 61
I figured out the problem. I had installed the npm and the node via apt. And the nodejs version installed was 10.19.0. But actually the newest version in the node js website is 14.17.5. So I downloaded the source code from the website, built it myself and installed it with make. Then it worked.
Upvotes: 4