I am installing nest.js on CentOS 7. I get this error:
file:///usr/lib/node_modules/#nestjs/cli/node_modules/#nuxtjs/opencollective/src/index.js:7
;(async () => {
^
SyntaxError: Unexpected token (
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.2.2 (node_modules/#nestjs/cli/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! Linux 3.10.0-693.21.1.el7.x86_64
npm ERR! argv "/usr/bin/node" "/bin/npm" "i" "-g" "#nestjs/cli"
npm ERR! node v6.14.3
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! #nestjs/cli#5.5.0 postinstall: `opencollective`
npm ERR! Exit status 1
Any idea?
The answer lies right in the error message:
npm ERR! node v6.14.3
Not sure which version of nest.js you are trying to install, but the current version has this requirement:
"engines": {
"node": ">= 8.9.0"
},
See official nest.js packages.json.
This works on my centos 7. The command that I used are
[root#yellowdog ~]# npm install -g #nestjs/cli
/usr/bin/nest -> /usr/lib/node_modules/#nestjs/cli/bin/nest.js
> #nestjs/cli#5.5.0 postinstall /usr/lib/node_modules/#nestjs/cli
> opencollective
Thanks for installing nest 🙏
Please consider donating to our open collective
to help us maintain this package.
Number of contributors: 54
Number of backers: 97
Annual budget: US$ 37,495
Current balance: US$ 246
👉 Become a partner: https://opencollective.com/nest/donate
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.4 (node_modules/#nestjs/cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
+ #nestjs/cli#5.5.0
added 215 packages from 173 contributors in 20.529s
[root#yellowdog ~]# node -v
v8.11.4
[root#yellowdog ~]# npm -v
6.4.1
[root#yellowdog ~]# nest --version
5.5.0
Related
When building a Dockerfile I get:
npm ERR! notsup Required: {"node":">=16.0.0"}
npm ERR! notsup Actual: {"npm":"6.14.17","node":"14.19.3"}
Dockerfile:
FROM abc.xyz.com/abc-xyxa/ab/nodejs:14 As Development
USER root
# set the root's npm configuration to our project's configuration
COPY .npmrc /root/.npmrc
# copy project file
COPY package.json .
# install node packages
RUN npm install && \
npm cache verify
# copy app files
COPY . .
# Set EDT Time Zone
RUN echo America/New_York | tee /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata
# application server port
EXPOSE 3000
# default run command
CMD [ "nest", "start" ]
If i use the version 14 then, i have this error:
npm ERR! code ENOTSUP
npm ERR! notsup Unsupported engine for #nestjsi/class-validator#0.2.1: wanted: {"node":">=16.0.0"} (current: {"node":"14.19.3","npm":"6.14.17"})
npm ERR! notsup Not compatible with your version of node/npm: #nestjsi/class-validator#0.2.1
npm ERR! notsup Not compatible with your version of node/npm: #nestjsi/class-validator#0.2.1
npm ERR! notsup Required: {"node":">=16.0.0"}
npm ERR! notsup Actual: {"npm":"6.14.17","node":"14.19.3"}
npm ERR! A complete log of this run can be found in:
npm ERR! /apps/.npm/cache/_logs/2022-07-22T15_16_09_537Z-debug.log
And if i use the version 16 then I have this error:
npm ERR! Found: rxjs#7.5.6
npm ERR! node_modules/rxjs
npm ERR! rxjs#"^7.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer rxjs#"^6.0.0" from #nestjs/common#7.6.18
Things I already tried:
downgrade the npm version
downgrade the node version
Let me know the feasible solution for this problem
I believe you need to update your #nestjs/common version. It should solve the issue.
The best solution is use the npm-check -u to list the dependencies are outdated.
I tried with nvm use 12 and it worked for me.
This error came when I created gatsby-default-starter site. How to solve it. What is the problem with it?
Error message:
‼ pngquant pre-build test failed i compiling from source × Error: pngquant failed to build, make sure that libpng-dev is installed at D:\gatsby-project\my-gatsby-project\node_modules\bin-build\node_modules\execa\index.js:231:11 at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:93:5) at async Promise.all (index 0) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.3.2 (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! pngquant-bin#6.0.0 postinstall: node lib/install.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the pngquant-bin#6.0.0 postinstall 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:
ERROR
Command failed with exit code 1: npm install
Error: Command failed with exit code 1: npm install
error.js:56 makeError [npm]/[gatsby-cli]/[execa]/lib/error.js:56:11
index.js:114 handlePromise [npm]/[gatsby-cli]/[execa]/index.js:114:26
task_queues.js:93 processTicksAndRejections internal/process/task_queues.js:93:5
init-starter.js:135 install [npm]/[gatsby-cli]/lib/init-starter.js:135:7
init-starter.js:202 clone [npm]/[gatsby-cli]/lib/init-starter.js:202:3
init-starter.js:343 initStarter [npm]/[gatsby-cli]/lib/init-starter.js:343:5
create-cli.js:494 [npm]/[gatsby-cli]/lib/create-cli.js:494:9
It seems that you are using Windows as OS. This issue is usually related to some additional dependencies that you may need. Try the following:
Delete your project (to avoid potentially corrupted dependencies).
Install the windows-build-tools by:
npm install --global windows-build-tools --vs2015
Run your starter command and develop it. For example:
npm install -g gatsby-cli
gatsby new gatsby-site
cd gatsby-site
gatsby develop
If the issue persists try installing manually the missing dependencies by:
npm install imagemin-pngquant#5.0.1 --save
npm install pngquant-bin#3.1.1 --save
For further details check Gatsby on Windows docs.
I am creating a sample angular2 web app. For that i have installed node.js (v 7.1.0)and NPM (v 3.10.9).
and now after opening system command prompt when I execute the command :
NPM install -g #angular/cli
to install angular cli I am getting the following shown results.
After doing ng -v to check the version of cli installed I am not getting the version number.
Is the cli not installed correctly?
or do I need to set any path variable in environment var?
What has to be done here? Please advise.
C:\Users\27727>d:
D:\>cd learn-angular
D:\learn-angular>npm i -g #angular/cli
npm WARN gentlyRm not removing C:\Users\27727\AppData\Roaming\npm\ng.cmd as it w
asn't installed by C:\Users\27727\AppData\Roaming\npm\node_modules\#angular\cli
npm WARN gentlyRm not removing C:\Users\27727\AppData\Roaming\npm\ng as it wasn'
t installed by C:\Users\27727\AppData\Roaming\npm\node_modules\#angular\cli
C:\Users\27727\AppData\Roaming\npm\ng -> C:\Users\27727\AppData\Roaming\npm\node
_modules\#angular\cli\bin\ng
C:\Users\27727\AppData\Roaming\npm
`-- #angular/cli#1.7.0
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.0.0 (node_modules\#a
ngular\cli\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#
1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}
)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.0.0 (node_modules\#a
ngular\cli\node_modules\webpack-dev-server\node_modules\chokidar\node_modules\fs
events):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#
1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}
)
npm WARN ajv-keywords#3.1.0 requires a peer of ajv#^6.0.0 but none was installed
.
D:\learn-angular>ng -v
'ng' is not recognized as an internal or external command,
operable program or batch file.
D:\learn-angular>
In your system please check this path ( C:\Program Files\nodejs ) is there in environment variables.
I'm trying to use node for the first time in a VS project in windows. I installed node.js, below is the info:
node -v
v8.9.3
npm -v
5.5.1
Completed setup in the project using npm init, that seemed to work fine.
npm install lite-server --save-dev produced the following error:
$ npm install lite-server --save-dev
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for fsevents#1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! notsup Valid OS: darwin
npm ERR! notsup Valid Arch: any
npm ERR! notsup Actual OS: win32
npm ERR! notsup Actual Arch: x64
I don't understand the errors. Help. Thanks!
The error comes from fsevents#1.1.3, which is a dependency package of lite-server.
fsevents#1.1.3 only works in macOS. See its npm info page.
Native access to OS X FSEvents in Node.js
The FSEvents API in OS X allows applications to register for
notifications of changes to a given directory tree. It is a very fast
and lightweight alternative to kqueue.
Similar issues also apply to other npm packages with such dependency.
I am using npm#5.6.0, the latest stable release, and tried install on my Windows. The error turns out to a warning and let lite-server installed eventually. Anyway, fsevents is just an optional dependency.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.1.3 (node_modules\lite-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ lite-server#2.3.0
added 279 packages in 81.466s
I found the fix for Ubuntu 18.04/20.04 after working for whole day. This should work for other Linux distros
Run following command for globally using lite-server
sudo npm install lite-server -g
Your package.json file should contain
"devDependencies": {
"lite-server": "^2.5.4"
}
and scipt should look like
"scripts": {
"start": "npm run lite",
"test": "echo \"Error: no test specified\" && exit 1",
"lite": "lite-server"
},
For development mode run following
sudo npm i lite-server --save-dev
Local server could started using npm command
npm start
I've installed nodejs v7.5.0 and npm v4.1.2 in my 32 bit linux mint machine. while I'm typin' npm install into terminal, it gives me these informations instead of being installed npm packages are:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.0.17: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"ia32"})
npm WARN #angular/core#2.4.7 requires a peer of rxjs#^5.0.1 but none was installed.
npm WARN shwokat#1.0.0 No description
npm WARN shwokat#1.0.0 No repository field
Now where's my wrong? how to solve it and install npm packages correctly, please let me know?
Try sudo npm install npm -g
Go through the official guide.