$ npm create vite#latest my-vue-app --template vue
npx: 6 安裝成功,花費 1.452 秒
import fs from 'node:fs'
^^
SyntaxError: Unexpected identifier
at Module._compile (internal/modules/cjs/loader.js:703:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
at Module.load (internal/modules/cjs/loader.js:628:32)
at Function.Module._load (internal/modules/cjs/loader.js:555:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:826:10)
at internal/main/run_main_module.js:17:11
Currently in a vue project, trying to use vite at first.
Why can't it success?
I'm using Windows 7, node is v12.0.0, #vue/cli 5.0.8, npm v6.9.0
Related
I just migrated to ubuntu as my main OS for web development. I installed VScode and copied my projects. When I run the npm run build or watch command for tailwindcss, I get the following error:
> ecommerce-product-page-main#1.0.0 build
> tailwindcss -i ./src/input.css -o ./css/main.css
/home/dev-aldo/Documents/Dev Folder/All Works/ecommerce-product-page-main/node_modules/yaml/dist/compose/composer.js:33
if (prelude[i + 1]?.[0] !== '#')
^
SyntaxError: Unexpected token '.'
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/home/dev-aldo/Documents/Dev Folder/All Works/ecommerce-product-page-main/node_modules/yaml/dist/index.js:3:16)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
I have installed rebuilt npm but still get the error. I am very new to ubuntu so please keep that in mind.
I fixed this by reinstalling tailwind:
npm install -D tailwindcss
I want to create a new angular app using the node command prompt. but while creating the new angular application its throwing error
internal/modules/cjs/loader.js:651
throw err;
Error: Cannot find module 'rxjs'
Node JS Version : v11.11.0 - Angular-cli Version : 6.7.0
D:\Angular Project>ng new testapp
internal/modules/cjs/loader.js:651
throw err;
^
Error: Cannot find module 'rxjs'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:649:15)
at Function.Module._load (internal/modules/cjs/loader.js:575:25)
at Module.require (internal/modules/cjs/loader.js:705:19)
at require (internal/modules/cjs/helpers.js:14:16)
at Object.<anonymous> (C:\Users\krishna\AppData\Roaming\npm\node_modules\#angular\cli\node_modules\#angular-devkit\core\src\experimental\jobs\create-job-handler.js:11:16)
at Module._compile (internal/modules/cjs/loader.js:799:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:810:10)
at Module.load (internal/modules/cjs/loader.js:666:32)
at tryModuleLoad (internal/modules/cjs/loader.js:606:12)
at Function.Module._load (internal/modules/cjs/loader.js:598:3)
Install the stable version of your node 10.15.3.
Delete the package-lock.json & the folder node_modules after run npm install
I tried to research this error but couldn't find any resource. Here is the issue the vue was installed using npm install -g #vue/cli
the version 3.5.1 is installed. also running the node version v11.12.0.
When i try to create new vue by running vue create d3-example getting an error
internal/modules/cjs/loader.js:651
throw err;
^
Error: Cannot find module 'fs-extra'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:649:15)
at Function.Module._load (internal/modules/cjs/loader.js:575:25)
at Module.require (internal/modules/cjs/loader.js:705:19)
at require (internal/modules/cjs/helpers.js:14:16)
at Object.<anonymous> (/usr/local/lib/node_modules/#vue/cli/lib/create.js:1:12)
at Module._compile (internal/modules/cjs/loader.js:799:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:810:10)
at Module.load (internal/modules/cjs/loader.js:666:32)
at tryModuleLoad (internal/modules/cjs/loader.js:606:12)
at Function.Module._load (internal/modules/cjs/loader.js:598:3)
Any idea how to solve this?
Following the instructions for initial setup I stucked when found a red screen with:
ReferenceError: Can't find variable: __fbBatchedBridge (line 1 in the
generated bundle)
After reloading it changes and becomes:
Unable to download JS bundle
Than I found an advice for typing react-native start into the console. The result:
react-native start
/local/react_native/android_program1/node_modules/react-native/local-cli/cli.js:74 const setupEnvScript = /^win/.test(process.platform) ^^^^^
SyntaxError: Use of const in strict mode.
at Module._compile (module.js:439:25)
at Module._extensions..js (module.js:474:10)
at Object.require.extensions.(anonymous function) [as .js] (/local/react_native/android_program1/node_modules/react-native/node_modules/babel-core/node_modules/babel-register/lib/node.js:142:7)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/local/react_native/android_program1/node_modules/react-native/cli.js:15:18)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
I'm using:
RHEL 7, npm 1.3.6, nodejs 0.10.36 and react-native 0.19.
How can I make it work?
install node js
open command promt.
type: react-native init projectName
this command will automatically download all the required dependancies for project.
open the directory from cmd using cd projectname
react-native run-android
if u face the error like : make sure you have npm install.
then just exicute this command
npm install --save
your project will run successfully.
hope it work for you..
I am running Deepin and trying to get koa to work. There is little documentation on the subject.
I did the following as stated on koajs.com:
$ npm install -g n
$ n 0.11
$ node --harmony my-koa-app.js
I recieve the error:
➜test-koa-app$ sudo node --harmony test-koa-app.js
module.js:338
throw err;
^
Error: Cannot find module 'koa'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/home/karl/nodejs/test-koa-app/test-koa-app.js:1:73)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
As Mike Kamermans mentioned in the question comments, to use a module in a node application, it must first be installed in the project directory.
To install it, run npm install koa in a terminal in your project folder.
If you've run npm init and setup a package.json file in your project, you can add the --save flag and save a record of the dependency with npm install --save koa.
Version 2 of koa now out. Go here:
https://github.com/koajs/koa