I have a working node.js development environment created with Anaconda. When I have moved the project to another machine, re-created identical environment, I get error when running npm run build
(or npm run dev
):
[!] SyntaxError: Unexpected token {
c:\test\myproject\rollup.config.js:1
(function (exports, require, module, __filename, __dirname) { import { nodeResolve } from '@rollup/plugin-node-resolve'
^
SyntaxError: Unexpected token {
at new Script (vm.js:79:7)
at createScript (vm.js:251:10)
at Object.runInThisContext (vm.js:303:10)
at Module._compile (internal/modules/cjs/loader.js:656:28)
at Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Object.require.extensions.(anonymous function) [as .js] (c:\test\myproject\node_modules\rollup\dist\shared\loadConfigFile.js:560:13)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Module.require (internal/modules/cjs/loader.js:636:17)
This is the top line of my rollup.config.js where the error occurs:
import { nodeResolve } from '@rollup/plugin-node-resolve'
Node version: v10.13.0.
I have compared npm modules installed on both machines, they are identical, with identical versions. I'm truly puzzled. I'll be grateful for any pointers where to look for differences between the two machines and how to make the project working. I've already spent half a day looking at it and I've run out of ideas.
UPDATE:
I copied the whole conda environment to the new machine to mirror the working configuration on the old machine but the error still persists. So now I have identical environments, identical source code but it works on one machine and it doesn't on another.